Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Form generated in servlet - how to get values from it?

837302Feb 15 2011 — edited Feb 16 2011
I have an index.html page that gives the users the option to select any number of items from a selection box.

When the user clicks the submit button, my servlet dynamically creates a form and displays the user selections along with a textbox beside each of the selections (ie: if they choose 1 option, there is only 1 tb, if they choose 3, there are 3 tbs...).

The textbox is going to take an int and will serve as a quantity value that I will do a calculation with and display the total on the same servlet page (or should I send it to a new html or servlet??)

How can I get the values from the textboxes that are generated by my servlet?

Here is my code for creating the textbox, giving each one a unique id.

out.print("<td rowspan=\"2\"><input type=\"text\" name=\"number\" id=\""+i+"\" value=\"1\" style=\"width:50px;height:23px;font-weight:bold;\" /></td>");

Edited by: EJP on 16/02/2011 15:17: corrected your title. 'Form', not 'forum'.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 16 2011
Added on Feb 15 2011
6 comments
1,377 views