By: Emiley J. Viewed: 153409 times Printer Friendly Format
1. Extend When You Must
•Struts framework can be stretched and customized to allow for customized behavior.
•Configuration classes in the Struts framework (say, Struts configuration file , ActionServlet RequestProcessor) can be substituted for a customized version.
•Declarative Exception Handling mechanism also allows for custom exception handlers to be used to better respond to application failures.
•Extension should be done judiciously.
•Before extending a Framework, we should always make sure that the functionality doesn't already exist somewhere.
2. Use Application Modules
•Splitting of a single Struts application into multiple modules is allowed.
•This solves one of the biggest complaints that development groups of more than a few people have had for some time because we can create Separate Struts Configuration Files for Individual Applications.
•Each Struts application module should have its own configuration file. This allows us to configure separate Actions, ActionForms, exception handling, and much more, independent of other application modules.
3. Use Declarative Exception Handling
•Struts framework includes a class called ExceptionHandler.
•This class by default is responsible for processing any exceptions that occur during action execution.
•This class actually creates an ActionError object and stores it in the appropriate scope object.
•This allows the JSP pages to use the errors to inform the user of a problem.
•Customized ExceptionHandler classes can also be used.
4. Use a Base Action for your application
•Often, Actions in an application will need to perform some basic tasks.
•To ensure these tasks are implemented consistently, create a base Action that can be sub-classed by other actions in the application.
5. Check logins at the Controller Leveljkmx
6. Use Validator Framework for validating user input
7. Use Custom tags instead of using scriplets and Java code in JSP pages..,
Most Viewed Articles (in Struts )
Latest Articles (in Struts)
Comment on this tutorial
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews