You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Robert Taylor <rt...@mulework.com> on 2002/08/29 13:25:49 UTC

RE: [Newbie] Where to put Model Access whenever Action class is not an option?

A general strategy would be to have a "set up" action which populates your
form or
retrieves data and places it in the appropriate scope and then forwards to
the page.

For example: If I want to display a page which allows a user to edit their
account, I would
have a showEdit action to prepare the page (retrieve existing user account
info, populate
the form) and then an edit action to save any changes.

HTH,

robert


> -----Original Message-----
> From: Rademacher Tobias [mailto:Tobias.Rademacher@grob.de]
> Sent: Thursday, August 29, 2002 1:15 AM
> To: 'struts-user@jakarta.apache.org'
> Subject: [Newbie] Where to put Model Access whenever Action class is not
> an option?
>
>
> Hi Folks,
>
> first of all I'm a newbie to Struts. As far as I can see it's a great
> framework. Thx for that a lot.
>
> My Problem is that my JSP-Views needs some inital data from the models.
> Consider some <select>-boxes given the
> user a chance make their choices....
>
> Where can I init the FromBeans that are use to share data between Action
> class/View? The constructor of
> the class? As far as I understand the Struts delegates form View to Action
> using the FormBean and ActionMappings.
> So Action is always the end of the request chain  (view
> ---o-action(controler)-o-model). Correct?
> So I need something like that: model -----O controler O----- view.
>
> As far as I can see the Struts HTML/Logic TLs offering
> java.util.Collection
> processing. So my idea is build an
> Taglib that can access the Model (EJB's with finder methods returning
> collection or Local interfaces).
> Is this okay, or is there a better solution?
>
> Any help is appreciated. :-)
>
> Gruß
>
> Toby
>
> --
> 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: [Newbie] Where to put Model Access whenever Action class is not an option?

Posted by Andrew Hill <an...@gridnode.com>.
I tend to make use of the dispatch action so that I can bundle the pre and
post action code in the same class. (Along with some other associated code).
This is useful in that both often need to make use of the same methods, and
it helps me keep my code organised (by reducing the number of classes to
something approaching what a mortal human such as my self can handle). A
thing to remember if you use the dispatch action for this is that you need
to submit the "method" parameter in your request so it knows which method to
call (though there is nothing stopping you from tacking this onto the end of
the url in your mappings in struts-config which is something I do a lot).

-----Original Message-----
From: Robert Taylor [mailto:rtaylor@mulework.com]
Sent: Thursday, August 29, 2002 19:26
To: Struts Users Mailing List
Subject: RE: [Newbie] Where to put Model Access whenever Action class is
not an option?


A general strategy would be to have a "set up" action which populates your
form or
retrieves data and places it in the appropriate scope and then forwards to
the page.

For example: If I want to display a page which allows a user to edit their
account, I would
have a showEdit action to prepare the page (retrieve existing user account
info, populate
the form) and then an edit action to save any changes.

HTH,

robert


> -----Original Message-----
> From: Rademacher Tobias [mailto:Tobias.Rademacher@grob.de]
> Sent: Thursday, August 29, 2002 1:15 AM
> To: 'struts-user@jakarta.apache.org'
> Subject: [Newbie] Where to put Model Access whenever Action class is not
> an option?
>
>
> Hi Folks,
>
> first of all I'm a newbie to Struts. As far as I can see it's a great
> framework. Thx for that a lot.
>
> My Problem is that my JSP-Views needs some inital data from the models.
> Consider some <select>-boxes given the
> user a chance make their choices....
>
> Where can I init the FromBeans that are use to share data between Action
> class/View? The constructor of
> the class? As far as I understand the Struts delegates form View to Action
> using the FormBean and ActionMappings.
> So Action is always the end of the request chain  (view
> ---o-action(controler)-o-model). Correct?
> So I need something like that: model -----O controler O----- view.
>
> As far as I can see the Struts HTML/Logic TLs offering
> java.util.Collection
> processing. So my idea is build an
> Taglib that can access the Model (EJB's with finder methods returning
> collection or Local interfaces).
> Is this okay, or is there a better solution?
>
> Any help is appreciated. :-)
>
> Gruß
>
> Toby
>
> --
> 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>


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