• 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

generic Validation class with optional parameters

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to create a generic Validation class which will have all form value validation in it.
It will also be able to append an error message to a String buffer.I want to use a Data Bean
to store all form data/request parameters and pass this bean as a parameter to a method
validate(databean) in the Validation class. But the parms being passed are optional or required in
different cases when the Validation class is called. Right now, the procedural program just uses a
getparm(req,res,parmname,isrequired,..) and uses the parmname to decide if the variable is optional
or required.Itthrows an error msg if the parameter is required yet missing. This getparm method is called about
35-40 times before doing an insert into a table with these values. It gets pretty ugly in the servlet
code. How can i account for the optional or required feature for each parameter in the Validation
class or the Data Bean or in any other way?
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic