> But to gather information for use on a JSP, the bean must know how to
gather that data from
> the business layer (model). BAD!!

This is incorrect. The bean doesn't do anything by itself. The Controller
(Action) communicates with the Model to provide whatever information will be
required by the View. The View (e.g. JSP) just picks up the relevant
information (from the request or session or elsewhere) and displays it.

> The handler should configure the bean BEFORE dispatching to the JSP. This
way, the bean remains
> "dumb" and the handler centralizes all knowledge of the business layer.

It does. In this context, the "handler" is the Action class. As part of the
Controller, the Action class is responsible for setting up the data so that
it can be displayed by the View.

--
Martin Cooper


----- Original Message -----
From: "Burleson, Thomas" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 26, 2001 1:58 PM
Subject: Use of form beans - design issue...


> Good point. And default/auto construction issue illuminates a design
concern.
>
> Currently -- as I understand it -- the ActionForm (bean) is populated by
the ActionServlet using introspection. And the Bean is then used by the
Action (handler) to modify/update the business
> layer or model data. Then the actionForward is used to indicate which JSP
the Servlet should forward/dispatch to. The page (which could be a different
JSP page or the same used for the request) then searches for the ActionForm
(bean) and creates one if it does not exist in the request scope.
>
> So (finally) here is the issue:
> The controller and handler uses a "dumb" bean to modify the model (MVC).
Cool!
> But to gather information for use on a JSP, the bean must know how to
gather that data from
> the business layer (model). BAD!!
>
> The handler should configure the bean BEFORE dispatching to the JSP. This
way, the bean remains
> "dumb" and the handler centralizes all knowledge of the business layer.
>
> Struts seems to use 2 different patterns/approaches: the incoming
processing is very different than the processing used during display of the
JSP.
>
> Is my understanding correct?
>
> ThomasB
> Calmwater Software
> ThomasB@Calmwaters
>
>
> -----Original Message-----
> From: Andreas Amundin [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 26, 2001 3:22 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Creation of form bean
>
>
> It is created by struts if it does not already exist.  This is why the
form
> beans has to have a default constructor.
>
> If one exists it will be used to populate the form with default values.
>
> Rgs,
> Andreas
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, July 26, 2001 1:18 PM
> > To: [EMAIL PROTECTED]
> > Subject: Creation of form bean
> >
> >
> >
> >
> > Hi.  Just a quick question - if I link directly to a jsp
> > which contains an
> > html:form tag with a formbean specified which I use on
> > submit, is the formbean
> > created by Struts?
> >
> > Or do I need to go through an empty action just to create it?
> >
> > thanks,
> >
> > Dave
> >
> >
> >
>


Reply via email to