Question

I am using Struts 1.2.9 .The application is facing a problem when i am using multiple tabs.

Say when i am filling up the fields in each tab simultaneously , i am able to see data entered from 2nd tab's request number updated in DB for 1'st tab's request number.

Am not sure whether synchronizing the execute method for the action would work.

Was it helpful?

Solution

Nutshell: no, but it also depends on what specifically you're talking about.

Struts 1 actions are like servlets: there is a single instance per action mapping. In general you almost never want to use instance variables to store any state. If your issue is with request-level data then the action(s) were coded incorrectly and instance variables should be eliminated.

If the issue is with session-level data it's harder to solve: In most browsers, tabs in the same browser window share sessions.

If you need to have multiple users in multiple tabs then you'd need to implement an additional layer of session scoping similar to JBoss Seam and similar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top