Role of first two is clear to me but I didn't understand the use of other two (3 & 4)???
When we can/should use PlugIn and RequestProcessor???
posted 9 years ago
Actually, there are a good deal more than four server-side components in Struts. Don't forget ActionMapping, ActionForward, ActionConfig, ActionServlet, and a good many others. You can see their descriptions in the Struts javadoc.
Regarding your questions:
A common reason to create a class that implements the org.apache.struts.action.Plugin interface would be when you want to do something when your Struts application starts up. You can put such logic in the init() method. Once you have created the class, you then register it as a plugin in the struts-config.xml file. For example, if you're using Hibernate in your applications, initializing the Hibernate session factory is something commonly done in a plugin.
org.apache.struts.action.RequestProcessor is the class that processes all requests. It is the real work horse of Struts. In most Struts applications, you can just use this class as is. However, if you want to customize the way requests are processed by, for example, checking that the user is logged in for every request, then you'd want to create class that extends RequestProcessor and register it in the struts-config.xml file. [ July 18, 2006: Message edited by: Merrill Higginson ]