I have thought about that, but before I do I'd like to know how/when objects 
are pushed/popped off the ValueStack.  I'd hate to have all the data needed to 
render a single page maintained in the session.  This is particularly important 
if you have a series of screens that might be tied to a single action.  For 
example...

MyWorkflowAction {
    //Only used to render result of executePageOne
    List<MyBigObject> pageOneObjects;

    //Only used to render result of executePageTwo
    List<MyMediumObject> pageTwoObjects;

    //Only used to render result of executePageThree
    List<MyOtherBigObject> pageThreeObjects;

    public String executePageOne(){...}
    public String executePageTwo(){...}
    public String executePageThree(){...}
}

Are actions stored in the equivalent of the request namespace?  If so, what's 
the recommended way for preserving data between requests?


----- Original Message ----
From: Don Brown <[EMAIL PROTECTED]>
To: Struts Users Mailing List <user@struts.apache.org>; Jon Wilmoth <[EMAIL 
PROTECTED]>
Sent: Wednesday, December 13, 2006 12:09:05 PM
Subject: Re: Struts2 Storing/Retrieving View objects


Just provide getter methods on your action.  Then, you can retrieve
the data in your jsp through either jsp expressions - ${myProp} - or
the Struts 2 tags.  Struts 2 makes your action object's properties
automatically available to your jsp or other template file.

Don

On 12/13/06, Jon Wilmoth <[EMAIL PROTECTED]> wrote:
> I'm preparing to make the switch from Struts 1.x to Struts 2 for new 
> development and had a few questions related to how objects used to render 
> data in a JSP page should be stored/retrieved for a desired http namespace. 
> One of the design tenants I try to employ in my current S1 webapp is 
> minimizing HttpSession bloat by storing objects needed to render jsp pages as 
> request attributes instead of session attributes. I understand S2 has tried 
> to insulate the actions from the http communication details by introducing 
> the ValueStack. I generally like the idea, but I'm having a difficult time 
> understanding how/when different items are pushed/popped. For example in my 
> S1 action if I knew the target jsp result page needed a list of objects as 
> well as the current user to display info I'd bind the objects to the view 
> like so:
>
> //List only need to render immediate next page
> request.setAttribute("myListOfObjects", objectList);
> //User needed to render immediate next page and other page
> session.setAttribute("currentUser", currentUser);
>
> How would I bind the objects in S2 such that the objectList is not present in 
> the ValueStack after the request? How do I ensure the currentUser is present 
> in the ValueStack for multiple requests?
>
> Thanks in advance,
> Jon
>
> p.s. I've read through both the "Comparing Struts 1 and 2" and "Struts 1 
> Solutions" guides and didn't find the answer to my question.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to