Struts2如何搭建?

如何搭建Struts2:

  1.导入jar包

commons-fileupload-1.3.jar
commons-io-2.0.1.jar
commons-lang3-3.1.jar
freemarker-2.3.19.jar
javassist-3.11.0.GA.jar
ognl-3.0.6.jar
struts2-core-2.3.15.3.jar
xwork-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()方法:

posted @ 2013-12-01 22:09  iLincoln  阅读(171)  评论(0编辑  收藏  举报