1.下载strtuts2.5包
2.替换工程中的附件目录文件
a.freemarker-2.3.23.jar
b.log4j-api-2.5.jar
c.ognl-3.1.2.jar
d.struts2-config-browser-plugin-2.5-BETA3.jar
e.struts2-convention-plugin-2.5-BETA3.jar
f.struts2-core-2.5-BETA3.jar
g.struts2-json-plugin-2.5-BETA3.jar
h.struts2-spring-plugin-2.5-BETA3.jar
i、javassist-3.20.0-GA.jar
j、slf4j-api-1.7.12.jar
备注:
删除slf4j-api-1.5.2.jar对应slf4j-log4j12.jar
l、commons-lang3-3.4.jar
commons-fileupload-1.3.2.jar
commons-io-2.4.jar
commons-logging-1.1.3.jar
备注:删除commons-logging-1.1.1.jar对应commons-logging-api-1.1.jar
3.添加:asm-3.3.jar
asm-commons-3.3.jar
asm-tree-3.3.jar
4.删除原工程“xwork-core-2.3.16.jar”
5.修改web.xml,把“<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>”修改成“<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>”
6.修改jsp的struts标签,新版本里有两处明显区别
a.类似 <s:bean name="com.whb.common.DictItem" id="dictItem" /> 要修改成 <s:bean name="com.whb.common.DictItem" var="dictItem" />
b.类似<s:property value="result" escape="false"/> 要修改成 <s:property value="result" escapeHtml="false"/>
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
private static Logger log =LogManager.getLogger(login.class);
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<constant name="struts.enable.DynamicMethodInvocation" value="true"/> 禁止调用动态方法
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
新版struts2 2.5.2 部署到外网
出现java.lang.UnsupportedClassVersionError: org/apache/struts2/dispatcher/filter/StrutsPrepareAndExecuteFilter :
Unsupported major.minor version 51.0
解决方法:把JDK升级至jdk1.7版