File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Action Intances" Watch "Struts Action Intances" New topic

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.

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33130

Moving to our Struts forum

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
I agree. Here's the link:
subject: Struts Action Intances
jQuery in Action, 3rd edition