This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 2.0, persist data across requests Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2.0, persist data across requests" Watch "Struts 2.0, persist data across requests" New topic
Author

Struts 2.0, persist data across requests

Deepak Srivastav
Greenhorn

Joined: Jul 18, 2008
Posts: 1
Hello,

I have a class TestAction which has two action methods.

class TestAction {
List<Item> items = new ArrayList<Item>();
// getter and setter methods for items

public String execute(){
//populate items
}

public String modifyItems(){
//modify items on the list
}
}

when I call execute, i populate.
In my next request, i call modifyItems(), and this should modify the item list.

Currently, we are storing the list onto the session in the execute() method and retrieveing in the modifyItems() method.

Is there anything in struts 2.0 using which i can achieve the same?

Regards,
Deepak
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts 2.0, persist data across requests
 
Similar Threads
parameter variable to action class instance variable
Populating a list of Objects in Struts2
Indexed Properties Example
Struts: No getter method for property name problem
Struts logic:iterate weirdness