Nico
Nico

Reputation: 343

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? :)

Upvotes: 1

Views: 2905

Answers (2)

SwT
SwT

Reputation: 83

You can define the length from aList like this first :

<bean:define id="leng" name="aList" property="SomeLength"/>

then use it :

<html:text styleClass="input-text" name="SomeForm" property="lalalala" size="<%=leng%>">

Upvotes: 2

Srinu Chinka
Srinu Chinka

Reputation: 1491

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>

Upvotes: 3

Related Questions