|
|
Activity:
Question posted: 03 05 2010 04:54:50 +0000,
3 answers, 104 views, last activity
07 06 2010 20:18:08 +0000
|
|
|
|
hi
H
Struts is an open source framework used for developing J2EE web applications using Model View Controller (MVC) design pattern. It uses and extends the Java Servlet API to encourage developers to adopt an MVC architecture. Struts framework provides three key components.
1.A request handler provided by the application developer that is used to mapped to a particular URI.
2.A response handler which is used to transfer the control to another resource which will be responsible for completing the response.
3..A tag library which helps developers to create the interactive form based applications with server pages.
The Struts framework is composed of approximately 300 classes and interfaces which are organized in about 12 top level packages. Along with the utility and helper classes framework also provides the classes and interfaces for working with controller and presentation by the help of the custom tag libraries. It is entirely on to us which model we want to choose. The view of the Struts architecture is given below:
The Struts Controller Components:
Whenever a user request for something, then the request is handled by the Struts Action Servlet. When the ActionServlet receives the request, it intercepts the URL and based on the Struts Configuration files, it gives the handling of the request to the Action class. Action class is a part of the controller and is responsible for communicating with the model layer.
The Struts View Components:
The view components are responsible for presenting information to the users and accepting the input from them. They are responsible for displaying the information provided by the model components. Mostly we use the Java Server Pages (JSP) for the view presentation. To extend the capability of the view we can use the Custom tags, java script etc.
The Struts model component:
The model components provide a model of the business logic behind a Struts program. It provides interfaces to databases or back- ends systems. Model components are generally a java class. There is not any such defined format for a Model component, so it is possible for us to reuse Java code which is written for other projects. We should choose the model according to our client requirement.
Struts 2.0 Feature
A number of the new features introduced in the Struts 2.0 framework work towards the goal of making Struts simpler to use:
- Improved design: In contrast with Struts 1, all of the Struts 2 classes are based on interfaces. Core interfaces are HTTP independent. These APIs are not dependent on Servlet APIs.
- Simplified Actions: Struts 2 Action classes are framework independent and are simplified plain old Java objects (POJO). Any Java class with an execute() method can be used as an Action class.
- POJO forms: Struts 2 does not support the ActionForms feature. The properties that are defined in the ActionForms can be put directly on the Action classes. You do not need to use all String properties.
- Intelligent defaults: Most of the configuration elements in the Struts 2 configuration file will have default values, so there is no need to set values unless a different value is required. This helps reduce the configuration you need to do in the XML file. Struts 2's support for annotations helps make this even easier to achieve.
- Enhanced results: In Struts 2, the >forward< tag is replaced by the <result> tags. Unlike ActionForwards, Struts 2 results help in preparing the response and provide flexibility to create multiple types of output.
- Enhanced tags: Struts 2 tags don't just send output data, but also provide stylesheet-driven markup so that you can create consistent pages with less code. Struts 2 tags can now work with FreeMarker, Velocity, and similar template engines.
- Introduction of interceptors: Struts 2 provides exhaustive support for interceptors. Interceptors can be executed before and after an Action class is executed. Interceptors are configured to apply common functionality, such as workflow or validation, to a request. All the requests pass through a set of interceptors before they are sent to an Action class. After the Action class is executed, the request passes through the interceptors again in the reverse order.
- Ajax support: To create dynamic Web applications that use Ajax, Struts 2 provides an Ajax theme, which gives interactive applications a significant boost. Struts 2 tags for Ajax are based on Dojo widgets. Plug-ins are available for other frameworks as well.
- QuickStart: Deployed configuration files are reloadable; hence, many changes can be made on the fly without the need to restart the Web container.
- Stateful checkboxes: The Struts 2 framework automatically tracks checkboxes; if a checkbox is missing, the default value -- false -- is assumed. Hence, unlike in Struts 1, checkboxes do not require special handling for false values.
- Easy testing: Struts 2 Actions are HTTP independent and thus framework neutral. They can be tested easily without using mock objects.
- Use of annotations: Applications built using Struts 2 can use Java 5 annotations as an alternative to XML and Java properties configuration. Annotations minimize the need for XML. Annotations are available for Actions, interceptors, validation and type conversion.
- Easy plug-in: Struts 2 extensions can be installed by dropping the plug-in JAR file into the \WEB-INF\lib directory. No manual configuration is required.
- Easy integration with Spring: Struts 2 Actions are Spring-aware. Just adding Spring beans to an application will add Spring support.
- Easily customized controllers: Struts 1 allows the request processor to be customized per module; in Struts 2, you can customize the request handling per action, if required.
"STRUTS 2.0 is a client side framework" ==who told you that?
"It is based on usage of ActionServlet as the Controller and Action Classes "== fetaure of struts 1.2.X not struts2.0.
this is a public forum.every one try to know something.so be carefull when you post your answer.
if you have lack of information ,then dont post.
Thanks and Regards
Shubhashish
Hi Manoj,
STRUTS 2.0 is a client side framework used for developing web applications in java.
It is based on usage of ActionServlet as the Controller and Action Classes as the classes containing the basic method calls from the JSP. We use simple JSPs to create the GUI. For more details please check the web. This follows the MVC pattern (Model View Controller).
Model - Session Bean
View - JSP
Controller - ActionServlet
I hope i could give u some idea on STRUTS.
Have a nice day
- Create a confidential Career Profile and Resume/C.V. online
- Get advice for planning their career and for marketing of experience and skills
- Maximize awareness of and access to the best career opportunities
|
|
|
|
|
|
|
|
|
|
|
|