It's not a secret anymore!
The moose likes Struts and the fly likes server side component in Struts... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "server side component in Struts..." Watch "server side component in Struts..." New topic

server side component in Struts...

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
There are four server side component in Struts:

1. ActionServlet
2. Action
3. PlugIn
4. RequestProcessor

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???

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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 ]

Consultant, Sima Solutions
I agree. Here's the link:
subject: server side component in Struts...
It's not a secret anymore!