Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

struts 2: application in different tabs

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic