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!

How to preserve form input when not all inputs are valid

843833Sep 12 2001 — edited Oct 4 2001
I want to be able to have form data repopulated in the case where one or more fields are invalid so that the user doesn't have to reenter all of the fields if only one or two were invalid. Currently I'm using a servlet for handling the form (validation of form fields) and it dispatches the request to another JSP if all form field entries are valid. If one or more of the form field entries are invalid I redirect back to the same form page and display error messages about the offending form input entries. I'd like to populate the form input fields with the entries which were valid from the previous attempt in order to prevent the user from having to refill the entire form. I've done this using ATG/Dynamo jhtml pages incorporating beans but I now want to do the same using vanilla JSP/servlets. I'm not sure how it can be done using JSP/servlets but I'll be very surpised if it can't be done in some way.






Use case:


-Present a form page


-User fills in form fields


-Servlet handles form fields doing validation of the inputs


-One or more inputs is invalid, but some inputs are valid, so redirect back to form page


-Re-present the form page, displaying error messages AND filling form fields with all valid inputs entered at previous attempt(s)





Any help or suggetions will be appreciated.











-James
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 1 2001
Added on Sep 12 2001
12 comments
1,980 views