Hi, I have a data entry page in jsp, where there are 10 textfields for input, the user will enter data in these fields and press enter, then i want to take this data from input field and pass to a validating bean , this bean will validate the data, if the data is valid it will update the database, and return true, and if the data is not valid return false, so if the result is true, i want to send the success message and blank the entry fields which happens because i am submitting the form, or if the result is false, i want to retain all the data entered by the user on the screen and display the error messages. But when i sumbit the form all the fields get intialized and then i have to put those back in session and reload them on the jsp page. Is there a better way, has anyone designed this kind of arctiecture
A$HI$H
Shawn Bayern
Author
Ranch Hand
Joined: May 06, 2002
Posts: 160
posted
0
Originally posted by kulkarni_ash: But when i sumbit the form all the fields get intialized and then i have to put those back in session and reload them on the jsp page. Is there a better way, has anyone designed this kind of arctiecture
You might be interested in the 'Input Taglib' at Jakarta Taglibs (http://jakarta.apache.org/taglibs) that I wrote some years ago. It's not actively maintained, but I believe it provides the specific feature you're looking for: it ties the form fields to the values that the user previously chose. It's somewhat more common to use a framework like Struts that provides associated taglibs to tie the value of form fields to some back-end data.
Shawn Bayern<br />"JSTL in Action" <a href="http://www.jstlbook.com" target="_blank" rel="nofollow">http://www.jstlbook.com</a>
And, escpecially if you are forwarding back to the original page, it's pretty easy to roll your own. Remember that in the case of a forward, the original request parameters are still there on the request, and you can add as many attributes to the request as you need to tell your page what to do. hth, bear