一、 最小化安装需要的jar
struts2-core-2.x.x.jar
xwork-2.x.x.jar
ognl-2.6.x.jar
freemarker-2.3.x.jar
commons-logging-1.1.x.jar
commons-fileupload-1.2.1.jar
二、struts2的配置文件为struts.xml,框架会从classes下扫描该文件,所以放到src目录 下,这点和struts1不同,基本内容如下:
三、注册struts2,在web.xml下添加过滤器
struts2-core-2.x.x.jar
xwork-2.x.x.jar
ognl-2.6.x.jar
freemarker-2.3.x.jar
commons-logging-1.1.x.jar
commons-fileupload-1.2.1.jar
二、struts2的配置文件为struts.xml,框架会从classes下扫描该文件,所以放到src目录 下,这点和struts1不同,基本内容如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
</struts>
三、注册struts2,在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>