• 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

Best way to do form input ?

 
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've done around 3 different web applications now, and all 3 have handled JSP form input & field validation in different ways - so the question I pose to you all is, what is the best way?
Given these constraints:
1) clean & simple design
2) easy linking between the JSP form fields and the bean fields (loading)
3) easy way to do validation
I would guess that some degree of reflection would be used to automate the field processing.
So here's my current take on things:
Common JavaBean, but with the addition of a set of validation methods (get/set/validate) that take in String input and validate it against the field type. I'm planning on naming the fields in the JSP exactly as the field name in the bean, although that might run into problems if the input uses more than one bean and they have the same fieldnames. Once the form is submitted, go through all the input parameters calling the validate & set methods for the appropriate fields.
how's that sound?
 
reply
    Bookmark Topic Watch Topic
  • New Topic