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?