Example & Tutorial understanding programming in easy ways.

What steps are required to for an application migration from Struts1 to Struts2?

Struts1 and Struts2 applications can run side by side, within the same web application. This thing can be achived by implementing new features in the latest version, and migrate older code to new one as needed.

Optionally, some common resources may be shared between Struts1 and Struts2, like messages, validation rules, and Tiles configurations, making for an even smoother migration and eassy to maintain.

Here are the following steps that u can follow to make it to move to the newer Struts version successfuly:

1. Add the Struts 2.0 Jar files support to your exisitng Struts1.x application.

2. Configure Struts2 to handle .action requests and let Struts1 handle .do requests.

3. Study known Struts1 applications, rewritten for Struts 2 - Familiar applications such as the Struts Mailreader are being rewritten to demonstrate best practices for Struts2.

4. Use or create a tool that reads the web.xml and Struts1 configuration files, and generates the corresponding Struts2 configuration files. Comparing the converted files with the originals could also serve as a training tool.

5. Modify objects to utilize existing Struts1 resources, and utilities to convert resources to Struts2 equivalents.

6. Create a Struts2 TextProvider that retrieves messages from the Struts1 MessageResources instance in the servlet context.

7. Create an Interceptor that can apply Struts1 validations to Struts2 actions, converting error messages to Struts2 format. An Action and/or Interceptor that executes a Commons Chain instance.

8. Implement Struts2 Action interface on Struts1 Action; Extend Session-Aware Interceptor to set properties corresponding to Struts1 execute parameters and populate. Extend the Struts1 Action Interceptor to load and process PlugIns

9. Utilize XSLT and other text processing tools to convert Struts1 configuration file struts-config.xml to Struts2 configuraion file struts.xml, validations.xml to a global Struts2 validations.xml, and Struts1 message resources to global Struts2 resource.properties

10. Convert Struts1 Action classes to session-aware Struts2 Action classes.

11. Convert Struts1 JSPs to Struts2 JSPs.

Read More →