Andras Balogh wrote:
>
> If I understand You corectlly You have one form
> and in the Servlet You want to decide wich submit button
> was pressed. (like Previous or Next).
>
> If You have in your html form:
>
> <input type="submit" name="submitbuton" value="Previous">
>
> <input type="submit" name="submitbuton" value="Next">
>
> than in Your servlet get the parameter submitbuton. Like this:
>   String buton=request.getParameterValues("submitbuton")[0];
>                     or request.getParameter("submitbuton");
>
> than
>
> if( buton.equals("Previous") ) {
>                                  file://something
>                                      }
> else {
>        file://something else
>
>         }

It might be better to give different names to the buttons.
        <input type="submit" name="PreviousPage" value="Previous">
        <input type="submit" name="NextPage" value="Next">

Then your servlet just needs to check like this:

        if (request.getParameterValues ("PreviousPage") != null) {
                //do something
        }

When checking the value, if you change the value so that the form displays a
different label on the button, then you have to change the servlet as well. If
you check for the value != null, then you can change the label on the button at
any time:
        <input type="submit" name="PreviousPage" value="Back">
        <input type="submit" name="NextPage" value="Forward">

and the servlet code will work without modification.

Kevin Mukhar

___________________________________________________________________________
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