*
The moose likes Struts and the fly likes how to diplay daynamic image in struts> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to diplay daynamic image in struts>" Watch "how to diplay daynamic image in struts>" New topic
Author

how to diplay daynamic image in struts>

Robert Smith
Greenhorn

Joined: Oct 14, 2003
Posts: 23
how to diplay daynamic image in struts>
Eric Sexton
Ranch Hand

Joined: Sep 12, 2003
Posts: 133
How is the image dynamic? Is it based on some session attribute or something?
Robert Smith
Greenhorn

Joined: Oct 14, 2003
Posts: 23
i want to display the daynamic image according to the database record!i.e
i want to search the database for the data,the according to the data ,i display the image ,it all daynamic?
can anyone help me?
Franck Tranchant
Ranch Hand

Joined: Aug 07, 2003
Posts: 75
Robert,
As far as I know, Struts build-in taglibs don't support images (that are not form-related, such as submit button)
So, you will have to re-create the correct HTML code to display your pictures by yourself.
For example, let's say you have a set of pictures in the \images\ directory of your application. Actually each item you have in a database has a GIF file in this directory. The name of each picture is based on item's unique Id in datase.
Item Id 01 in database <=> picture item01.gif
Item Id 02 in database <=> picture item02.gif
etc..
Now, imagine you want to display item infos + item photo on your JSP.
You could use code similar to this in your JSP :
<logic:iterate id="item" name="itemList">
- <bean:write name="item" property="itemId"/><br>
- <bean:write name="item" property="itemName"/><br>
- <bean:write name="item" property="itemColor"/><br>
- <IMG SRC="images\item<bean:write name="item" property="itemId"/>.gif"><br>
</logic:iterate>
as a result, for each row :
- 01
- TestItem
- black
- [you picture here, with SRC property = "images\item01.gif"]
- 02
- AnotherTestItem
- red
- [you picture here, with SRC property = "images\item02.gif"]
Hope is helps...


Franck<p>--------------------
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to diplay daynamic image in struts>
 
Similar Threads
image upload in applet from user's pc
how to display image in popup window
using servlet to create a html page with embedded Image
Multiple mouseover text on same image javascript
creating image using AJAX and displaying on web page