• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to diplay daynamic image in struts>

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to diplay daynamic image in struts>
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is the image dynamic? Is it based on some session attribute or something?
 
Robert Smith
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic