Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Action Class - Thread safe

 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In our struts action class....we take the inputs from the formbean object and based on the values assign it to a object that represents all input params.

In formbean we have limited form fields but the object representing the input params has more values...

the scope of this object is...limited to the execute method

Request 1) ..some of the values in the object representing request will be populated

Request 2) ..Some value in the inputs is empty but the object representing request (not formbean) is still having the data from the earlier request

Struts version : 1.2 ...doesnt it spawn new threads and hence this object will be created

Regards








 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In strtus1.2 action class is not thread safe we have to handle it because only one instance action class serve all the requests where it was modified in struts2. For each request new object will be created no need to bother about thread safe.
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah i agree with this...

For each request new object will be created no need to bother about thread safe....


but my query was...why do i still see old values for 2nd request.....

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic