sunny_dev
sunny_dev

Reputation: 755

struts 1 singleton classes

1) I would like to know which main classes in Struts 1 are are Singleton classes. Main classes like ActionServlet, RequestProcessor, Action, ActionForm etc.

2) Also, I heard from somebody that if we have multiple struts confix xml file in our struts application then for each module a new RequestProcessor will be instanstiated. Is this true ?

Thanks.

Upvotes: 0

Views: 680

Answers (2)

Roman C
Roman C

Reputation: 1

  1. To understand classes that are used by the Struts framework better look the the source code. If you did it you'll see that none of the classes you've mentioned implement a Singlton pattern. That means that nothing prevent them to make as many instances as you needed. But it depends on how these instances are managed.

  2. Not exactly, the request processor is created for each module in the case if there's not one is already created for a concrete module. See ActionServlet.getRequestProcessor

Upvotes: 0

shreyansh jogi
shreyansh jogi

Reputation: 2102

1) there is Actionclass which will be singleton like as we are not going to generate object explicitly.

2) and whatever number of struts-config file is there for that only requestProcessor instantiated

Upvotes: 1

Related Questions