配置struts-2.5.14.1必需jar包Struts2 2.5的特性变动
1.下载Struts2 : https://struts.apache.org/
Struts 2.5.14.1
Apache Struts 2.5.14.1 is an elegant, extensible framework for creating enterprise-ready Java web applications. It is available in a full distribution, or as separate library, source, example and documentation distributions. Struts 2.5.14.1 is the "best available" version of Struts in the 2.5 series.
- Version Notes
-
Full Distribution:
- struts-2.5.14.1-all.zip (65MB) [PGP] [MD5]
- Example Applications:
- struts-2.5.14.1-apps.zip (35MB) [PGP] [MD5]
- Essential Dependencies Only:
- struts-2.5.14.1-min-lib.zip (4MB) [PGP] [MD5]
- All Dependencies:
- struts-2.5.14.1-lib.zip (19MB) [PGP] [MD5]
- Documentation:
- struts-2.5.14.1-docs.zip (13MB) [PGP] [MD5]
- Source:
- struts-2.5.14.1-src.zip (7MB) [PGP] [MD5]
2. 解压 :struts-2.5.14.1-all.zip
我们能看到,当你一直找xwork2的时候,拉到最下面发现不见了!!!
是的,它已经整合到struts2-core当中去了!!!所谓core嘛,当然是一个核心,原来两个合并成一个也是有道理的。
但是随即增加了一下jar,各自功能需要大家自己查阅API,我就不废话了。
3.部署项目的必要jar包:
是就这么多,增加了lang3增强包!!!
4.web.xml文件过滤器也有变动:
if you are using struts2 version 2.5 you need to change from
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
to
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
是的,去掉了中间.ng文件空间名,原因是在整合xwork的时候,同时简化了不必要的包名空间。
<?xml
version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
5.在项目根目录空间下创建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>
</struts>