• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Input field and form ?

 
ashish kulkarni
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Shawn Bayern
Author
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ashishkulkarni,
JavaRanch has a Naming Policy Following it is a requirement for winning a book. Please read it and change your name to comply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic