Struts - HTML:image tag - help
843836Sep 3 2004 — edited Sep 7 2004Hi 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?