各版本struts所需导入的包
struts-2.0 所必需的jar包
1.commons-logging----.jar
2.struts-core----.jar
3.xwork----.jar
4.ognl----.jar
5.freemarker----.jar
struts-2.1.6 所必需的jar包
1.commons-fileupload----.jar
2.commons-logging----.jar
3.struts-core----.jar
4.xwork----.jar
5.ognl----.jar
6.freemarker----.jar
struts-2.3.4.1所必需的
1.commons-fileupload----.jar
2.commons-logging----.jar
3.struts-core----.jar
4.xwork----.jar
5.ognl----.jar
6.freemarker----.jar
7.commons-lang3----jar
8.javassist----.GA.jar
9.commons-io------.jar
10.commons-lang-----.jar
配置文件
web.xml配置文件
基本上只需配置一次剩下多是配置struts.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app version="3.0"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
- <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>
- </web-app>
struts.xml
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
- "http://struts.apache.org/dtds/struts-2.3.dtd">
- <struts>
- <package name="struts2" extends="struts-default">
- <action name="helloword" class="com.test.action.helloWorld">
- <result name="success">/helloworld.jsp</result>
- </action>
- </package>
- </struts>