How is the image dynamic? Is it based on some session attribute or something?
Joined: Oct 14, 2003
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?
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...