Configure the Struts2 startup information in the config file Web. xml:
<?xml version= "1.0" encoding= "UTF-8"?>
<web-app xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xmlns= "Http://java.sun.com/xml/ns/javaee" xsi: schemalocation= "Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version= " 3.0 ">
<display-name>Struts2</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
</web-app>
In the Struts.xml configuration file, configure the action code:
<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE Struts Public
"-//apache software foundation//dtd Struts Configuration 2.1//en"
"Http://struts.apache.org/dtds/struts-2.1.dtd" >
<struts>
Various configuration information
</struts>
Configuring the Struts2 startup information in the config file Web. xml