PDA

View Full Version : Dynamic Textbox


Ellusionist
Jun 2nd, 2006, 04:39 AM
Hi,

In my jsp file i get data which comes from a database and display it in a table.

There are three columns of data (comes from database) and in the fourth column I have a textbox.

The problem is that all the textboxes will have the same name because they are created in the loop.

Is there a work around?

Thanks.


<c:forEach items="${ol.orders}" var="ordersUndel">
<tr>
<td>
<c:out value="${ordersUndel.DelNum}" />
</td>
<td>
<c:out value="${ordersUndel.OrdNum}" />
</td>
<td>


<c:out value="${ordersUndel.dataNum}" />


</td>
<td>


<input type="text" size="10" maxlength="10" name="info"/>
</td>
</tr>
</c:forEach>

Priit
Jun 2nd, 2006, 06:50 AM
with c:out you can insert for example order number in name field like tis

<input type="text" size="10" maxlength="10" name="info-<c:out value='${ordersUndel.OrdNum}' />"/>

It's not pretty but it should work. going to test right now

-e-
yeah it works just fine. But maybe you should look to some comfortable framework if there are many tables in your webapp.

Valuelist (http://valuelist.sourceforge.net/) - havent tried
Displaytag (http://displaytag.sourceforge.net/11/) - looks easier
Display tag editable stuff (http://demo.appfuse.org/appfuse/demos/users-edit.jsp) - haven't tried but looks interesting