This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts 2: application in different tabs

 
Vani Bhatia
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic