配置struts2

1、Myeclipse2013的操作,右击项目-Myeliplse-Project Facets-Install struts2。在url pattern根据个人喜好可以选择/*或者.action,在导入架包选项取消,因为后面需要手动添加。完成后有两个变化:在src目录下会多一个struts2.xml文件;在webRoot\WEB-INF\web.xml里面多了以下内容:
<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>/*</url-pattern>
</filter-mapping>

2、为了保证项目能在其他电脑直接用,我们将jar包手动添加到webRoot下的lib目录。主要需要:commons-fileupload-1.2.2.jar、commons-io-2.0.1.jar、commons-lang-2.5.jar、commons-logging-1.1.1.jar
、freemarker-2.3.16.jar、javassist-3.11.0.GA.jar、ognl-3.0.1.jar
、struts2-core-2.2.3.jar、xwork-core-2.2.3.jar、asm-3.1.jar、asm-commons-3.1.jar,struts2的下载地址:http://struts.apache.org/download.cgi#struts2324
3、这样就配置完成了struts的部署。

你可能感兴趣的:(配置struts2)