Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Struts - HTML:image tag - help

843836Sep 3 2004 — edited Sep 7 2004
Hi Helpers!
I am using Struts HTML:image tag to create a dynamic form.
My JSP page gets an array of Strings and create a dynamic form like this:

<html:form action="subcategory">
Category <br>
<%
for(int i=0; i<cat_array.length; i++){
String temp = cat_array;
%>
<html:image src="images/+<%=temp%>+.jpg" property="catname" value="<%=temp%>"/> <%=temp%> <br>
<%}%>
</html:form>

In Struts-config.xml:

<form-beans>
<form-bean name="SubCategoryForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="catname" type="String"/>
</form-bean>
</form-beans>

now I want to get the String corresponding to the selected image.

html:image tag has a "value" attribute but I cant find how I can extract it in the Action.

I tried using ImageButtonBean as the property type (in the struts-config.xml) but It doesn't help much as long as I have different property names for different image buttons.

I can not use the category name as the property name. Since it is dynamic I can not specify the properties in the struts-config.xml file.

Can Anyone help me with this problem?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 5 2004
Added on Sep 3 2004
1 comment
336 views