简体   繁体   中英

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.

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

  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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM