| Author |
Text Boxes and JSP
|
tejaswini vasist
Greenhorn
Joined: Apr 10, 2004
Posts: 17
|
|
I have a JSP in which the text boxes are generated based on the no of items present in the database.How do i make the name of each text box unique.Also how do i retrieve the values of these text boxes in the servlet . My JSP code is : try { for (int i=0; i<numberOfItems; i++) { %> <tr> <td bgcolor=lightsteelblue><font face="verdana, arial, helvetica" size="2" width="20%"> <input type="hidden" name="id"+ i> <%=items.ItemID[i]%> </td> <td bgcolor=lightsteelblue><font face="verdana, arial, helvetica" size="2" width="20%"><%=items.ItemName[i]%></td> <td bgcolor=lightsteelblue><font face="verdana, arial, helvetica" size="2" width="20%"><%=items.Price[i]%></td> <td bgcolor=lightsteelblue><font face="verdana, arial, helvetica" size="2" width="20%"> <input type="text" name="quant" + i maxlen=3 visibility="false"></td> </tr> <% } } catch(Exception e) { System.out.println(e.getMessage()); } %> Is the syntax correct ? Also i want to know how to get these values in the servlet.
|
 |
Kaustubh Patil
Ranch Hand
Joined: Aug 13, 2001
Posts: 164
|
|
Well... just copying a part of your code.. with little modifications.. I think you can fill in the gaps.. notice the <%=i%> thing. also to retrieve the values [ April 16, 2004: Message edited by: Kaustubh Patil ]
|
Kaustubh. Mumbai, India.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56201
|
|
|
Why the try/catch block on the page? This is a poor practice.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: Text Boxes and JSP
|
|
|