This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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:
Map sessMap = ActionContext.getContext().getSession();
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..
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.