I've lost track of your original question, but you might look at JOT
Servlets for another model of what you wish to do.  The FORM parameters
are automatically available as JotServletBean properties - if there are
matching setters they are called automatically, if there are matching
getters they are used instead of the raw FORM parameters. The JOT Views
rendering engine with the same functionality can be invoked from your
controller Servlet. Neither JOT or the Struts example you cite are going
to automatically populate your POJO customer object. Often there are
conversions (numeric, date, etc.) and validations that you want to
perform on the incoming parameters anyway.

Paul Copeland
JOT Servlets Web Component Framework
http://www.jotobjects.com


 Date: Fri, 2 Sep 2005 18:52:41 +0200

 From: Dani Pardo <[EMAIL PROTECTED]> 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

Reply via email to