Search code examples
jspstruts-1

accessing a bean property as tag's attribute value while iterating over a list


I am iterating over a bean and this bean is an object with some properties. I want to use the bean property as value, something like the code below. I know how to access a bean property and use it as value of a tag's attribute, but the problem I have is when iterating over a list. What should be in place of "${object.description}" in the hidden element in the sample below?

<logic:iterate id="element" name="objectGrp" indexId="idx">

    <span class="label"><bean:write name="element" property="object.description"/></span>

    <html:hidden property="attachmentType" value="${object.description}" />
</logic:iterate>

Solution

  • I found what I was looking for..

    <bean:define id="desc" name="element" property="object.description"" type="java.lang.String"/> 
    <html:hidden property="attachmentType" value="<%=desc%>" />