• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Input field and form ?

 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic