Benefits of Struts 2 Farmework

Struts is an MVC framework that employs a filter dispatcher as the controller. When writing a Model 2 application, it is your responsibility to provide a controller as well as write action classes. Your controller must be able to do these:

1. Determine from the URI what action to invoke.

2. Instantiate the action class.

3. If an action object exists, populate the action's properties with request parameters.

4. If an action object exists, call the action method.

5. Forward the request to a view (JSP).

The first benefit of using Struts is that you don't have to write a controller and can concentrate on writing business logic in action classes. Here is the list of features that Struts is equipped with to make development more rapid:

• Struts provides a filter dispatcher, saving you writing one.

• Struts employs an XML-based configuration file to match URIs with actions. Since XML documents are text files, many changes can be made to the application without recompilation.

• Struts instantiates the action class and populates action properties with user inputs. If you don't specify an action class, a default action class will be instantiated.

• Struts validates user input and redirects user back to the input form if validation failed. Input validation is optional and can be done programmatically or declaratively. On top of that, Struts provides built-in validators for most of the tasks you may encounter when building a web application.

• Struts invokes the action method and you can change the method for an action through the configuration file.

• Struts examines the action result and executes the result. The most common result type, Dispatcher, forwards control to a JSP. However, Struts comes with various result types that allow you to do things differently, such as generate a PDF, redirect to an external resource, send an error message, etc.

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More