Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Struts Struts 2 imagae set to frame.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Rahul Vishvakarma
Struts 2 imagae set to frame.
0 Answer(s)      3 years and 7 months ago
Posted in : Struts


I could not set image to frame in stuts 2.

Here is the code :

1)index.jsp

<%@ taglib uri="/struts-tags" prefix="s" %>
<%@taglib uri="/struts-images" prefix="img"%>
<img:image src="%{src}" width="150" height="200"/>
File Name   : <s:property  value="fname"/><br><br>
File ContentType  : <s:property   value="ftype"/>

Here , src is property of ImageUploadAction class,which have getter method also .

FileInputStream in=new FileInputStream(userImage);
byte b[]=new byte[in.available()];
in.read(b);
in.close();
System.out.println("File name : "+userImageFileName);
FileOutputStream fout=new FileOutputStream("f:/"+userImageFileName);
src ="f:/"+userImageFileName;
System.out.println(src);
fout.write(b);
fout.close();
ValueStack vs=ActionContext.getContext().getValueStack();
vs.set("fname",userImageFileName);
vs.set("ftype",userImageContentType);
vs.set("src",src);

When i run this code , i got fname , ftype also src from value stack. And fname , ftype working in right way. But using this:

  <img:image src=%{src} width="150" height="200"/>, 

i could not render the image.

And if i go to imageInfo , after right click on image frame then i got all the info right.But the dimension was there : 0px,0px .

I could understand the reason . I want to set the image after uploading it please send me the line of working code.

Thank you. regards Rahul Vishvakarma.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
Struts 2 imagae set to frame.
Struts 2 imagae set to frame.  I could not set image to frame in stuts 2. Here is the code : 1)index.jsp <%@ taglib uri="/struts-tags" prefix="s" %> <%@taglib uri="/struts-images" prefix="img"%> <img
Struts 2
Struts 2  we can extend DispatchAction class to implement a common session validation in struts 1.x. how to do the same in the struts2
Advertisements
Struts 2
Struts 2  I am getting the following error.pls help me out. The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has
Struts 2
Struts 2   I am just new to struts 2 and need to do the task. I have a requirement like this : when i click on link like Customer , this will display all the customers , address from a database table using jdbc and the screen
Struts 2 - Validation - Struts
Struts 2 - Validation annotations  digging for a simple struts 2 validation annotations example
Set Frame Inside HTML
Set Frame Inside HTML       The Tutorial helps you to understand how to set Frame Inside HTML. In this Tutorial, the code create a Inline frame inside a HTML
how to set a image in frame? - Swing AWT
how to set a image in frame?  how to set a image in frame using swing
struts 2 tabbedpanel - Struts
struts 2 tabbedpanel  Hi Friend do I change the background color of a tab? bye bye
Struts 2 problem - Struts
Struts 2 problem  Hello I have a very strange problem. I have an application that we developed in JAVA and the application works ok in Windows... seemed to worked fine, until the user reported to us a problem. After doing
Struts 2 RequiredFieldValidator - Struts
What is Struts 2 RequiredFieldValidator? Need an Example or Code  What is Struts 2 RequiredFieldValidator? Need an Example or Code on Field Validation in Struts 2.  Please follow the following instruction:1. index.jsp
Struts 2 Integration with Struts 1
Struts 2 Integration with Struts 1  I want to integrate struts 2 with struts 1 existing application. Can you please help on how to go about this. I am not finding any good source to integrate struts 2 with struts 1 framework
struts 2 testing
struts 2 testing  can i get an example for struts 2 action class unit test
regarding struts 2
regarding struts 2   is it not possible to get values from applicationresources.properties into our application in struts 2
Struts 2 online tutorial
Struts 2 online tutorial  Where to learn struts 2 online tutorial? Is there any good tutorials on roseindia.net for learning struts 2 online tutorial?   Yes, We have many tutorials for learning Struts 2 online through
Where to learn Struts 2?
Where to learn Struts 2?  Hi, I am beginner in Struts and trying to find good tutorial to learn Struts 2 framework. My project is in Struts 2 and soon I have to work on the project. Let's know where to learn the Struts 2
Cohabitation struts 1 and 2 - Struts
Cohabitation struts 1 and 2  Hi, I have a problem with the cohabitation of struts 1 and 2. I work on a web application which used struts 1. But i must add some functionality in struts 2. When i modify my web.xml file
Struts 2 Video Tutorial
Struts 2 Video Tutorial  I think its easy to learn from Struts 2 Video Tutorial. What is the url of Struts 2 Video Tutorial on roseindia.net website... your are right. You can learn Struts 2 very easily with the Struts 2 Video
What is Struts 2 framework
What is Struts 2 framework  Hi, I am new to the Java web programming. I have completed JSP, Servlet and HTML. Now I want to learn Struts 2. Tell me what is Struts 2? Thanks
Struts 2 + hibernate
Struts 2 + hibernate  How to integrate Struts 2 and Hibernate? Its urgent please help!!   See the example give below.. for integrating struts 2 and hibernate. Struts2.2.1 and hibernate integration application Integrate
Integrating Struts 2 with hybernate - Struts
Integrating Struts 2 with hybernate  Can anyone please help me how to integrate Struts 2 with hybernate. Is there any small project online fo the same? what is the advantage of integrating struts 2 with hybernate over normal
Struts 2 + Hibernate
Struts 2 + Hibernate  From where can i get good tutorial from integrating struts 2 with hibernate , which explains step by step procedure in integration and to build web applications
struts 2 project samples
struts 2 project samples  please forward struts 2 sample projects like hotel management system. i've done with general login application and all. Ur answers are appreciated. Thanks in advance Raneesh
HOW TO DISPLAY 2 SET OF CONTROLS
HOW TO DISPLAY 2 SET OF CONTROLS  i can be display one row by selecting value from drop down box BUT ALSO i need to display 2 rows by selecting value...').getElementsByTagName('tbody')[2]; tbody.appendChild(tr); } else if(b==2) { tr.innerHTML = '<
Struts 2 Application
Struts 2 Application Developing user registration application based on Struts 2 Framework This Struts 2 Application is a simple user registration application... of Struts 2. Struts 2 Framework makes it easy to develop enterprise web applications
Struts 2 - Beganner
Struts 2 - Beganner  Hi ! I am new to Struts2 and I need clarification over Difference between Action Proxy and Action Mapper in struts2 and When both perform their activity?????? Many Thanks Venkateshlu
struts 2 mysql
struts 2 mysql  In the example : http://www.roseindia.net/struts/struts2/struts-2-mysql.shtml how is the username and password(in insertdata.jsp) which is entered by the user is transferred to the { ("INSERT employee VALUES
session maintain in struts 2
session maintain in struts 2  hi i am new to Struts 2..... in Action class i wrote **HttpSession session = request.getSession(); session.setAttribute("name", name1);** but in jsp class String session_name=(String
Introduction to Struts 2 Framework
and then teach you how to develop your first application using Struts 2 frame...Introduction to Struts 2 Framework - Video tutorial of Struts 2 In this video... of the Struts 2 Framework. The Struts 2 framework is very elegant framework
Struts 2 Tutorial
Struts 2 Tutorial  Hi, Iâ??m taking your Struts 2 Tutorial at http://www.roseindia.net/struts/struts2/struts-2-hello-world-files.shtml. When I open http://localhost:8080/struts2tutorial/ under â??Testing Struts 2 Hello
How to set the Gradient Color as a background color for Java Frame?
How to set the Gradient Color as a background color for Java Frame?  How to set the Gradient Color as a background color for Java Frame
Time Picker in struts 2 - Struts
Time Picker in struts 2  How to create Time Picker in Struts 2 ? ...;head> <title>Struts 2 Time Picker Example!</title>...;</ul>2. struts.xml (Add the following code)<action name="
 

 

 

DMCA.com