  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | -none- | -none- 2007-09-04 - By Pooja Kaur
Back 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 <ssubhani@(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: user-unsubscribe@(protected) > For additional commands, e-mail: user-help@(protected) > >
|
|
 |