Search code examples
javalistjspjavabeansstruts-1

how to get <bean:write> value to be used in <html:text size="?">


Does anyone know how to set the size at my input box?

My code:

<logic:iterate id="aList" name="SomeForm" property="MyList">
<html:text styleClass="input-text" name="SomeForm" property="lalalala"
size="<bean:write name="aList" property="SomeLength">">
</logic:iterate>

In this code the value inside the bean cannot be read in the size property but if I put the bean outside,the value can be seen. Can anybody help? :)


Solution

  • You can use JSP EL like this:

    <logic:iterate id="aList" name="SomeForm" property="MyList">
        <html:text styleClass="input-text" name="SomeForm" property="lalalala"
        size="${aList.SomeLength}">
    </logic:iterate>