Struts2如何搭建?
如何搭建Struts2:
1.导入jar包
commons-fileupload-1.3.jarcommons-io-2.0.1.jarcommons-lang3-3.1.jarfreemarker-2.3.19.jarjavassist-3.11.0.GA.jarognl-3.0.6.jarstruts2-core-2.3.15.3.jarxwork-core-2.3.15.3.jar
2.在web.xml中添加过滤器filter
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-name>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3.创建struts2.xml文件,添加相关配置
<struts>
<package></package>
<constant></constant>
<include></include>
<bean></bean>
</struts>
4.创建Action,实现execute()方法: