












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of the role of various controller components, including actionservlet, requestprocessor, and action, in the struts framework. It also explains the concept of actionmapping and its configuration in the struts-config.xml file. Developers can use this information to build web applications using the struts framework.
Typology: Slides
1 / 20
This page cannot be seen from the preview
Don't miss anything!













override execute() method (perform() method in Struts 1.0)
struts-config.xml
web.xml
One for each module
Developer extends Struts-provided Action class
Developer specifies action mapping in struts- config.xml file Struts framework creates ActionMapping object and passes it to Action object
Process user requests Determine what the user is trying to achieve according to the request Pull data from the model (if necessary) to be given to the appropriate view, and Select the proper view to respond to the user
loads the application config corresponding to the "config" init-param's in web.xml goes through an enumeration of all init-param elements, looking for those elements who's name starts with config/ for modules To access the module foo, you would use a URL like: http://localhost: 8080 /myApp/foo/someAction.do
Determine the path that invoked us. This will be used later to retrieve an ActionMapping.
Select a locale for this request, if one hasn't already been selected, and place it in the request.
Set the default content type (with optional character encoding) for all responses if requested.
Determine the ActionMapping associated with this path.
If the mapping has a role associated with it, ensure the requesting user is has the specified role. If they do not, raise an error and stop processing of the request.
Instantiate (if necessary) the ActionForm associated with this mapping (if any) and place it into the appropriate scope.
Populate the ActionForm associated with this request, if any.
Perform validation (if requested) on the ActionForm associated with this request (if any).
If this mapping represents a forward, forward to the path specified by the mapping.
Finally, the process method of the RequestProcessor takes the ActionForward returned by your Action class, and uses to select the next resource (if any). Most often the ActionForward leads to the presentation page that renders the response.
<form-beans> contains FormBean definitions including name and type (classname) <action-mapping> contains action definitions Use an
This section contains your form bean definitions. You use a <form-bean> element for each form bean, which has the following important attributes: name: The name of the request (and session level attribute that this form bean will be stored as) type: The fully-qualified Java classname of your form bean
This section contains your action definitions. You use an
Each