This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes Data overwrite for Concurrent Request in ActionForm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Data overwrite for Concurrent Request in ActionForm" Watch "Data overwrite for Concurrent Request in ActionForm" New topic

Data overwrite for Concurrent Request in ActionForm

Ghulam Rashid
Ranch Hand

Joined: Jan 14, 2002
Posts: 278
I have problem with data overwrite when concurrent request comes in. Below is the flow.
JSP -> ActionForm -> Action Class -> Bean Class for Business/Data

When two request comes from 2 different browsers together, one for requesting Employee data for EMP Number 100 and other for Emp Number 200. so, on both the browser window data for Emp Number 200 is displyed. That means it displays the data for the last request always, overwriting old request.

Few Things.

1. In JSP, we are iterating through using <logic:iterate> and then <bean:write formProperty>.
2. Setter method of the Form is populated in the bean class using -
PropertyUtils.setProperty(OutputForm, aColNames[i].toString(), RowContentString);
3. We are not using any instance variable in bean class for populating form property using setter method.

Dont know why ActionForm is not sustaining old data.

Any pointer will be of great help.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I doubt this is a problem with your ActionForm. Struts provides a separate instance of this class for each individual user.

I'd check your action class. This class is multi-threaded and must not have instance variables that are not common to all users.

If you are sure the execute() method of your action class is thread-safe and are still getting the problem, post your code, and we'll see if we can help you solve the problem.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Data overwrite for Concurrent Request in ActionForm
It's not a secret anymore!