9.3 Controller Extension Points (Ipower web hosting) The next set of

9.3 Controller Extension Points The next set of possible extension points is within the controller layer. Some of these have been mentioned briefly in previous chapters, but they’re repeated here for completeness. 9.3.1 Extending the ActionServlet Class In earlier versions of the Struts framework, it was almost a given that an application needed to extend the ActionServlet class because most of the controller functionality, excluding the Action class behavior, was present in this class. With Struts 1.1, this is no longer true. However, there are still a few good reasons why you might need to extend the ActionServletclass. As was pointed out in Chapter 5, the initialization routines that are invoked when a Struts application is first launched reside in the ActionServlet class. If you need to modify the way the framework initializes itself, this is the place to do so. To extend the ActionServlet class, just create a subclass of org.apache.struts.action.ActionServlet. You can then override the method or methods that you need to function differently. Once this is done, you need to modify the deployment descriptor so that the Struts application will use your custom ActionServlet: storefront com.oreilly.struts.storefront.framework.ExtendedActionServlet Most of the runtime request-processing behavior has been moved to the RequestProcessorclass in Struts 1.1. If you need to customize the manner in which your Struts application processes a request, see the next section. 9.3.2 Extending the RequestProcessor Class If you need to override functionality within the RequestProcessor class, you must let the framework know that it should use your customized version rather than the default. You can make the framework aware of your specialized RequestProcessor by modifying the configuration file for the Struts application. If your configuration file doesn’t already have a controller element within it, you’ll need to add one (there are several attributes that can be configured within the controller element see Chapter 4 for more details):
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Leave a Reply