This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Displaying an  image in jsp using struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Displaying an  image in jsp using struts" Watch "Displaying an  image in jsp using struts" New topic
Author

Displaying an image in jsp using struts

Sham Jowsaki
Ranch Hand

Joined: May 22, 2001
Posts: 146
Hi All,
Displaying image in jsp using struts, My requirement is that I have an URL which will dynamically get it from DB using DAO / VO mechanism. I have to add that URL in image tag, say url1 has the real content url

<html:image property="url1" src="url1" name="contentVO" />
is this correct syntax?
pls help me out of image tag.
Thanks
Cheers
jowsaki
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Hi there,
There is a difference between <html:image /> and <html:img />. The former is used to render an image-like submit button. The latter is used to render a graphic image.
The latter can be implemented in a number of ways:

or:

or:

Cheers,
Darryl
Sham Jowsaki
Ranch Hand

Joined: May 22, 2001
Posts: 146
Hi Darryl,
Tks for your reply..
But in my case, I have the path of the image is in property field (url1 = http://localhost/xyz.gif) now I need to pass this value in img src="" field.
Can you pls advise me.
thanks
cheers
jowsaki
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Try this

or

Cheers,
Darryl
Sham Jowsaki
Ranch Hand

Joined: May 22, 2001
Posts: 146
Sorry Darryl,
thanks for your response.
I solved the stuff by writing the property value as bean:write.
Thanks
Jowsaki
xavier sundar
Greenhorn

Joined: Jan 09, 2013
Posts: 2
Hi,
In case of BLOB image or image from local url(d:/directorypath/filename.jpg).
How to display this.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Displaying an image in jsp using struts