Apache Struts 2 is another popular Model – View – Controller (MVC) framework from the Apache foundation. Since the inception of Struts 1, it is one of the most popular framework used by the Java developers. Struts 2 enhances the functionality to latest trend in the web applications development like AJAX, Annotations, etc. with simplified implementation approach. This tutorial lists down all the articles and tutorials related to Struts 2 topic from Javabeat.
Struts 2 Architecture
( Image Source )
Struts 2 Getting Started
- String 2.0 Introduction and Validations : This article provides an introduction to Struts 2.0 and its new Validation Features. Since Struts 2.0 is new, the first few sections of the article discusses in brief about the basics of Struts 2.0, its architecture and its various New Features.
- Struts 2 Features : List of new features introduced with the release
- Hello World Example : Getting started hello world example program to start writing your first struts 2 application. This example provides the complete source code with XML configuration files.
- HttpServletRequest in Struts 2 Action Class : This explains how to get the HttpServletRequest object inside your action class. It is necessary for some specific scenarios where you have to set values to the request object. It is a simple demonstration to get the object.
- HttpServletResponse in Struts 2 Action Class : This explains how to get the HttpServletResponse object inside your action class. It is necessary for some specific scenarios where you have to set values to the response object. It is a simple demonstration to get the object.
- HttpServletContext in Struts 2 Action Class : This explains how to get the HttpServletContext object inside your action class. It is necessary for some specific scenarios where you have to set values to the context object. It is a simple demonstration to get the object.
- Difference Between FilterDispatcher and StrutsPrepareAndExecuteFilter in Struts 2 : What is the main difference between these two filters used for the struts configuration. These classes are added to the web.xml deployment descriptor for loading struts configuration files.
- Migrating Struts 1 Applications to Struts 2 : the latest release of struts was in the market and there is a demanding need to migrate the old applications developed with struts to new struts release in order to make use of the powerful features offered by new release.
Struts 2 Configurations
- Configuration Files Path : The location and path for the different configuration fles used in the struts 2 applications. Also shows the sample folder structure for a simple application.
- Exception Configuration : Shows how to configure exceptions thrown in your action class in the configuration file. It can be configured per action maping level. It is new addtion to the struts 2 release.
- Interceptors Example : List of default interceptors in the struts 2 framework and how one can configure the custom interceptors to their application. Interceptors are invoked as the call back methods before and after the action class.
- Resource Bundle Example : This post demonstrates how to create properties files for stroing the labels for the components used in the web page and how to load them in your application.
- Custom Interceptor : n this application, we have created a custom interceptor “MyCustomInterceptor” which keeps track of the time spent in the action class. The interceptor is created in the interceptors package inside Source Packages sub directory.
Struts 2 Integration with Other Frameworks
- Log4j Integration : How to integrate log4j to your application and print the log messages.
- Spring Integration Example : Spring framework enables the Inversion of Control (IOC) container to manage the struts components (action class, beans) as the spring managed beans.
- Annotation Example : How to write simple struts 2 application using the annotations. It is a getting started gude for using the annotation with your struts application.
- JSON Integration : This post shows how your struts application can return JSON result from the server.
- Struts 2 and JPA Integration : Struts can be used to build the user interface tier of the enterprise application. Whereas, any of the popular ORMs like Hibernate, JPA, iBatis can be used for the persistence tier of the application. Struts2 provides easy integration with these persistence tier frameworks.
- Struts 2 and Hibernate Integration : This article demonstrates the integration of Struts 2.0 applications with the Hibernate. The concept is explained with the help of a sample application.
Struts 2 UI Tags
- TextArea Tag Example : Create TextArea component in your JSP file and submit the values to the server.
- Hidden Tag Example : Create Hidden component in your JSP file and submit the values to the server. It is not popularly used in the recent days.
- Select Tag Example : Create Select component in your JSP file and submit the values to the server.
- Radio Tag Example : Create Radio component in your JSP file and submit the values to the server.
- CheckBox Tag Example : Create CheckBox component in your JSP file and submit the values to the server.
- Password Tag Example : Create Passoword component in your JSP file and submit the values to the server.
- TextField Tag Example : Create TextField component in your JSP file and submit the values to the server.
Struts 2 Control Tags
- Control Tags : List of control tags usied in the struts 2 applications.
- If, Else Tag Example : A bsic example for using the if and else construct in your struts application.
- Generator Tag Example : Example for struts generator tag in JSP file.
- Merge Tag Example : How to use merge tag for merging the two lists supplied from the server.
- Iterator Tag Example : How to use the iterator tag for looping the elements in a list.
Struts 2 Data Tags
- Include Tag Example : Include another source in the current page using the include tag.
- Push Tag Example : How to push the values to the top of the stack storage in the struts application context.
- Property Tag Example : It is common tag used with all other tags to print the bean or property values.
- Date Tag Example : How to use data tag.
- Bean Tag Example : It is similar to the useBean tag in JSP. It create bean instance in your current page.
- Action Tag Example : Send action execution to server and retrieves the result.