You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Agrawal, Rajeev" <Ra...@drkw.com> on 2002/07/22 17:16:36 UTC

Populating view from Web tier?

I have been reading some documentation on Struts. One thing I am not clear
about is how is the data sent back from Servlet to the view?

> In descriptive form the question is:
> 
> View -> Servlet -> ActionForm -> Action -> ActionForward -> JSP / HTML
> 
> The question is how do we send the data between ActionForward and JSP. I
> believe it will be ActionForm if the validation fails. If the validation
> doesn't fail then it has to be a class derived from ActionForm so that it
> is transparent to the view. Is that so? Where do we specify which class is
> used for sending the data to the view? Is that part of the Action code?
> 
> Cheers
> 
> Rajeev Agrawal
> Tel: 212-429-3216
> 


If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Populating view from Web tier?

Posted by Robert Taylor <rt...@mulework.com>.
In general, the page (view) should access data placed in either the
application, request, page, or session scope by the
Action class. It is considered a "best practice" for the Action class to act
as a proxy to your business tier. For example,
the Action class would leverage the appropriate business beans to process
the data. The Action class would be responsible
for placing the results of the processing (if any) in the appropriate scope.

The servlet, in the data transport diagram below, represents the front
controller or Struts ActionServlet,
and therefore it is not directly responsible for placing the data in the
respective scope, but rather delegates HTTP
requests to the appropriate Action class and forwards to the appropriate
view.

robert

> -----Original Message-----
> From: Agrawal, Rajeev [mailto:Rajeev.Agrawal@drkw.com]
> Sent: Monday, July 22, 2002 11:17 AM
> To: 'struts-user@jakarta.apache.org'
> Subject: Populating view from Web tier?
>
>
> I have been reading some documentation on Struts. One thing I am not clear
> about is how is the data sent back from Servlet to the view?
>
> > In descriptive form the question is:
> >
> > View -> Servlet -> ActionForm -> Action -> ActionForward -> JSP / HTML
> >
> > The question is how do we send the data between ActionForward and JSP. I
> > believe it will be ActionForm if the validation fails. If the validation
> > doesn't fail then it has to be a class derived from ActionForm
> so that it
> > is transparent to the view. Is that so? Where do we specify
> which class is
> > used for sending the data to the view? Is that part of the Action code?
> >
> > Cheers
> >
> > Rajeev Agrawal
> > Tel: 212-429-3216
> >
>
>
> If you have received this e-mail in error or wish to read our
> e-mail disclaimer statement and monitoring policy, please refer
> to http://www.drkw.com/disc/email/ or contact the sender.
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Populating view from Web tier?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 22 Jul 2002, Agrawal, Rajeev wrote:

> Date: Mon, 22 Jul 2002 11:16:36 -0400
> From: "Agrawal, Rajeev" <Ra...@drkw.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: "'struts-user@jakarta.apache.org'" <st...@jakarta.apache.org>
> Subject: Populating view from Web tier?
>
> I have been reading some documentation on Struts. One thing I am not clear
> about is how is the data sent back from Servlet to the view?
>
> > In descriptive form the question is:
> >
> > View -> Servlet -> ActionForm -> Action -> ActionForward -> JSP / HTML
> >
> > The question is how do we send the data between ActionForward and JSP. I
> > believe it will be ActionForm if the validation fails. If the validation
> > doesn't fail then it has to be a class derived from ActionForm so that it
> > is transparent to the view. Is that so? Where do we specify which class is
> > used for sending the data to the view? Is that part of the Action code?
> >

Typically, an Action will pass information via request attributes (or
sometimes session attributes), which can then be accessed by the view
layer.  It's also very common for an action to prepopulate a form bean
that will be used in a subsequent view -- for an example of this, take a
glance at the code for the Struts example webapp, when you click the "Edit
your user registration profile" link.

> > Cheers
> >
> > Rajeev Agrawal
> > Tel: 212-429-3216
> >
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>