File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Cattle Drive and the fly likes little HTML riddle in Reverse2Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "little HTML riddle in Reverse2Servlet" Watch "little HTML riddle in Reverse2Servlet" New topic

little HTML riddle in Reverse2Servlet

juliane gross
Ranch Hand

Joined: May 30, 2002
Posts: 161
suppose, I want to play with two fields in my reverse2servlet assignment, instead of one.
how does my doPost method then know which field to reverse (or do other similar important things with it)?
parms.getString gets "text"; where does this exactly come from?
I expected it to be the value in "name" of my input-field of my HTML-form, but if I change it to "text1" and then let call parms.getString( "text1" ) I get an error message of doPost.

thanks for any hints!
John Hembree
hired gun
Ranch Hand

Joined: Mar 07, 2003
Posts: 250

It should work exactly as you expected it to. parms.getString() should return the name of the form field as long as the form field is contained with your "form" tags. All form fields that are within the opening and closing form tags are passed with the form when the page is submitted. Your page can contain multiple forms and thereby transfer different set of fields as they relate to each form tag grouping. If you have fields that have the same name, then they should return as a comma delimited string when you click on submit.
juliane gross
Ranch Hand

Joined: May 30, 2002
Posts: 161
thank you, John!
It works
I agree. Here's the link:
subject: little HTML riddle in Reverse2Servlet
It's not a secret anymore!