Try this:
<table>
<% int i= 1;
%>
<struts2:iterator value="Questions">
<% String propertyName = "Qn"+i;
i++;
%>
<tr>
<td>Question <struts2:property value="questionID"
/><struts2:property
value="route" /></td>
</tr>
<tr>
<td>
<!-- How to give dynamic name to this text box? This answer is
needed
in next pages. -->
<struts2:textfield id="<%=propertyName%>" tooltip="Please enter text
here." >
</struts2:textfield>
</td>
</tr>
</struts2:iterator>
</table>
Thanks
On 8/31/07, Subhani Shaik <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> I have the following code...
>
> <table>
> <struts2:iterator value="Questions">
> <tr>
> <td>Question <struts2:property value="questionID"
> /><struts2:property
> value="route" /></td>
> </tr>
> <tr>
> <td>
> <!-- How to give dynamic name to this text box? This answer is
> needed
> in next pages. -->
> <struts2:textfield id="THIS NAME SHOULD BE DYNAMIC. I WANT THIS TO
> BE
> 'questionID' VALUE" tooltip="Please enter text here." >
> </struts2:textfield>
> </td>
> </tr>
> </struts2:iterator>
> </table>
>
> Here, 'Questions' is a class that contains 'questionID' as a field. And
> this
> returns 'List' over here. When i am iterating i'll get single item from
> the
> list. And my textfield name should be as the value of questionID (this is
> the key).
>
> I want something like this...
>
> <struts2:textfield id="Qn1"/>
> <struts2:textfield id="Qn2"/>
> <struts2:textfield id="Qn3"/>
> ... so on
>
>
> Regards,
> Subhani.
> --
> View this message in context:
> http://www.nabble.com/How-to-give-a-text-field-name-dynamically--tf4358482.html#a12421314
> Sent from the Struts - User mailing list archive at
> Nabble.com<http://nabble.com/>
> .
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>