Arun,
I think you can simplify this a little by accessing the PropertyDescriptor
instead.
If a form parameter from the HTML is "lastname" and there is a corresponding
bean property called lastname
with standard accessor methods of setLastname( String newlastname ) and
getLastname() you can assign the
form value as follows (with appropriate error checking etc):
Object[] args = new Object[1];
args[0] = new String( request.getParameter( "lastname" ) );
PropertyDescriptor p = new PropertyDescriptor( "lastname",
this.getClass() );
p.getWriteMethod().invoke( (Object)this, args );
Obviously this can be made into a loop on all the parameters as necessary.
This code also assumes the assignment code is in the bean, or a superclass,
hence this.getClass() above.
I actually use this to load data from either jdbc resultsets or xml files
into a bean
but I am sure it will work the same way for servlet parameters.
Note that I always code my bean accessor methods to accept and return String
data regardless (via the necessary format classes).
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets