wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts Action Intances Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Action Intances" Watch "Struts Action Intances" New topic
Author

Struts Action Intances

Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
Hi all,

How many action instances are created in a struts application?

The way i understand this is - If I have 10 different action classes for different use cases/actions, at any point of time, how many instances of each action class are created?

I belive it's one. But i was not sure so i did not answer this question

Any more input?


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Manjusha Muraleedas
Ranch Hand

Joined: Jun 02, 2010
Posts: 52

The action servlet creates action instances as they are requested... but only ONE instance for each path. Thus, Action subclasses MUST be thread-safe or you'll get some very odd results!

Form instances are created based on the scope associated with the action.
scope=session: One form instance per session.
scope=request [default]: One form instance per request.

refer

http://www.coderanch.com/t/47828/Struts/When-many-ActionForm-classes-Action
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

Moving to our Struts forum


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
Thanks!!
 
Consider Paul's rocket mass heater.
 
subject: Struts Action Intances
 
Similar Threads
form bean scope
filter objects
How many servlet instance will be created?
struts 1.X Action vs Actionmappings
instances of an action class