What I have always done, which is more work but nicer for the user, is
to build the server-side logic for this type of form all in one
page/servlet in the following way:
1. Check for form parameters passed to the page/servlet.
2. If there are none, they are new to the page, and the blank form
should be shown.
3. If there are parameters, validate them.
4. If all parameters are valid, process them, and display appropriate
page (or redirect to another URL).
5. If any parameters are invalid, display the appropriate message(s) at
the top of the page, and then re-display the form **with the values that
were previously entered** by the user.
The nice part for the user is not having to go "back", and they have the
error messages on the same page as the form, making it easier for them
to correct their entries.
I have done this previously in the ColdFusion and ASP worlds, but
haven't implemented it yet with servlets. The principals should still be
the same. With that caveat... good luck.
Hope this helps.
-Andrew
-----Original Message-----
From: Jeetandra Mahtani [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 10, 1999 3:16 PM
To: [EMAIL PROTECTED]
Subject: Submitting and Validating in the same page...?
Hello:
I have a servlet that displays six required input fields to a user. When
the user clicks
the submit button, the values entered by the user are validated against
a table. If they
are not valid, a page is displayed that points out the invalid values.
In order for the
user to correct his value, the user has to click the browsers back
button. Is it possible
to have a message box popup in the same page ( page where user enters
the values ) that
will display the invalid values and if the values are valid move on to
the next page. In
this way the user does not have to use the back button when invalid
values are entered.
Any suggestions/ideas would be appreciated.
Thanks,
J
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
________________________________________________________________________
___
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
___________________________________________________________________________
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