Hi,
An alternative would be to do what the jsp processor does. Write your own piece 
of code that uses reflection to determine what "setters" exist for the bean and 
match those up with the request parameter names. 
If you do some searching, you may find some free open source that does this 
already.
John Zerbe 

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED] Behalf Of Dani
Pardo
Sent: Friday, September 02, 2005 12:53 PM
To: SERVLET-INTEREST@JAVA.SUN.COM
Subject: Re: Filling-in a Bean inside a Servlet


>         Can I fill all the properties of the Bean magically on a line, The
> same way that the jsp does it via <jsp:setProperty property="*"> ???
>         There must be a trick or a workaround, because this method doesn't
> scale. There must be some trick to achieve to get a Customer object as a
> parameter:


  Hi, I respond to myself.
        I've done intensing search and I've finally get on the conclusion that
it can't be done:
        When using Servlets and JSPs, you play with FORM parameters on the jsp
side, and play with attaching attributes on the Servlet side. Acutally,
it's almost the same I've been doing with Perl CGIs and Template Toolkit.

        To do the magic-bean-populating trick, you have to use some esoteric
framwork like Struts:

 From http://www.coreservlets.com/Apache-Struts-Tutorial/

"With Struts, the normal processing flow is that a form submits data to
a URL of the form blah.do. That address is mapped by struts-config.xml
to an Action object, whose execute method handles the request. One of
the arguments to execute is a form bean that is automatically created
and whose properties are automatically populated with the incoming form
data. The Action object then invokes business logic and data-access
logic, placing the results in normal beans stored in request, session,
or application scope."


--
Dani Pardo, [EMAIL PROTECTED]
Enplater S.A

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
 
The information contained in this e-mail may be confidential and is intended 
solely for the use of the named addressee.
Access, copying or re-use of the e-mail or any information contained therein by 
any other person is not authorized.
If you are not the intended recipient please notify us immediately by returning 
the e-mail to the originator.(16b)

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to