> Another question.  My servlet generates serveral one-line text boxes each
> with a corresponding submit button.  How can I "poll" all of the text boxes
> and determine which one was pushed without having a req.getParameter() for
> each one.  I found a way.  I used the getQueryString() method.  It works
> great but I need the screen to be able to be refreshed without re-submitting
> the parameters at the end of the url.  Is there a way to solve this problem
> using <form method=post>? Any comments appreciated.

I used javascript for doing this, but there are a few ways to handle this.

Each button has a variable associated to it that is set with the onClick()
method that is associated to the button. This variable corresponds to a
hidden field in the form. Thus, if button 1 is clicked, the variable is set
to 1. If button 2 is clicks, the variable is set to 2. Then, it is just a
matter of using getParameter to grab the value of the hidden field. This
stuff is exactly what javascript was invented for.

A similar solution, but without the use of javascript:

One other method would be to have each field/button combination in a
different <form>. There could be a hidden field in the form that has the
number for the button being pressed. When the form is submitted, all you
need to do is check the value of the hidden field to determine which form
has been submitted.

-jon

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to