What is Struts 2.x?
Apache Struts 2.x is an open-source web application framework for developing Java EE web applications. It uses and extends the Java Servlet API to encourage developers to adopt a model-view-controller (MVC) architecture. Struts 2 was originally known as WebWork 2. After having been developed separately for several years, WebWork and Struts were combined in 2008 to create Struts 2.
For more information, refer to http://struts.apache.org/
Application or Analysis Unit Setup
Environment Profile
In order to analyze Struts 2.x based applications, you must select the following Environment Profiles in your application:
- Struts 2.x
XML files:
In the Application or Analysis Unit configuration, you need to select an XML directory that contains Struts XML files. The selection of the Struts 2.x Environment Profile will automatically find Struts Configuration XML files and manage them. This includes Struts configuration files that are usually named struts.xml and also other optional Struts related files:
- xml included in struts.xml
- <Action class name> - validation.xml
- <Action class name> <alias> - validation.xml.
These files are usually located in the java source directory of your application.
Restitution Sample for Struts 2
Note that:
- where there is no action class associated to an action in the XML file, the default method com.opensymphony.xwork2.ActionSupport.execute() is called and it always returns "success".
- This is why in this case, we create a direct link from the Struts Action to the Struts Result "success" instead of having lots of links to com.opensymphony.xwork2.ActionSupport.execute()