一、核心包的引用(刚开始学时用到的jar)
删去xwork-core-2.x.x.jar 同时需要加入log4j-api-2.5.jar
二、web.xml中的filter的改变
若不按照下面的话会出现java.lang.ClassNotFoundException异常。
<filter-class>
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
</filter-class>
三、struts.xml文件的开头变了
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
若不是,在使用一些特殊的标签时会出现类似于下面的异常。
1、必须声明元素类型 "global-allowed-methods"。
2、DOCTYPE struts这里有异常等
尤其是在使用通配符时出现这一类错误
还有就是Struts2.5在通配符上发生了一些变化
<package name="manage" namespace="/" extends="struts-default" >
<global-allowed-methods>*</global-allowed-methods>
<action name="*_*" class="com.java1234.action.{1}Action" method="{2}">
<result name="success">helloWorld.jsp</result>
<!-- 或者不用 <global-allowed-methods>*</global-allowed-methods>
使用下面得allowed-method标签来指明方法
-->
<!-- <allowed-methods>add</allowed-methods> -->
</action>
</package>
就这些了,亲自体验过半天。。。。。。。
四、
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console..
若控制台出现这个错误,就是你的struts.xml文件出错了,一定要细心检查,不用添加log4j-core-2.5.jar等jar,将核心包加入即可,当然只是入门时所用的包。