File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes struts 2: application in different tabs 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: application in different tabs" Watch "struts 2: application in different tabs" New topic
Author

struts 2: application in different tabs

Vani Bhatia
Greenhorn

Joined: Nov 25, 2009
Posts: 7
Hi,
I am developing a web application which does not need a user login. The user has to simply paste the info in a text box and this information is processed by an action class (action1) and presented to the user. Links are generated in the result . The links, when clicked, invoke some other actions. (action 2, action3...). I have to pass some Java collection objects and String variables from action1 to action2,action3 etc., Therefore I used the following logic:

In Action1:
-----------
Map sessMap = ActionContext.getContext().getSession();
sessMap.put("name", name);
sessMap.put("objs",listOfObjects);

In Action2 , Action2....
--------------------------
Map sessMap = ActionContext.getContext().getSession();
String nm =(String) sessMap.get("name");
List objList = (List) sessMap.get("objs);
.
.
.


This logic works fine if the user is using a single tab of the browser window. The problem arises when he starts a new analysis in a separate tab/window when the first tab/window is still open. Since the tabs/windows share the session, the session variables get reset with the new values and when he tries to access the results on old tab, the results are all messed up.

What is the clean and correct way of sharing the strings and collection objects among the action classes in this case? Is there any other way of solving this problem..

Thanks
David
Rees Byars
Greenhorn

Joined: Feb 13, 2012
Posts: 12
I made a plugin for handling multiple tabs in Struts2. If you try it out and have any problems, I can address them quickly for you. I'm releasing a new version in a couple of days that will add some new features as well (custom results for propagating conversations over redirects, additional configuration options, added support for programmatic creation/destruction of conversations), but it will be backwards compatible, so no worries.
 
Don't get me started about those stupid light bulbs.
 
subject: struts 2: application in different tabs
 
Similar Threads
Can I distinguish JButtons?
session in Strut2
Passing ArrayList of objects between action classes
Struts forward problem
Justify!!