struts2.1.8.1升级至2.3.24步骤:
JAR包修改:
新增JAR包:
commons-lang3-3.2.jar
javassist-3.11.0.GA.jar
替换JAR包:
commons-fileupload-1.2.1.jar —->commons-fileupload-1.3.1.jar
commons-io-1.3.2.jar —–>commons-io-2.2.jar
commons-logging.jar —->commons-logging-1.1.3.jar(这个可不替换)
freemarker-2.3.15.jar —->freemarker-2.3.22.jar
ognl-2.7.3.jar —-> ognl-3.0.6.jar
struts2-core-2.1.8.1.jar —-> struts2-core-2.3.24.jar
struts2-spring-plugin-2.1.8.1.jar —-> struts2-spring-plugin-2.3.24.jar
xwork-core-2.1.6.jar —–> xwork-core-2.3.24.jar
JSON部分
json-lib-2.1.jar —-> json-lib-2.3-jdk15.jar
struts2-json-plugin-2.1.8.1.jar —->struts2-json-plugin-2.3.24.jar
struts2-junit-plugin-2.1.8.1.jar —->struts2-junit-plugin-2.3.24.jar
修改文档类型声明:
struts.xml的文档类型声明修改:
原来
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN" "http://struts.apache.org/dtds/struts-2.1.7.dtd">
现在
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd">
validator验证文档XxxxxAction-ActionName-validator.xml的文档类型声明修改:
原来:
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.3//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
现在:
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
出现的问题:
问题1:freemarker.core._TemplateModelException:net.sf.json.JSONException: Object is null
分析:原因是对象是null造成的,暂时通过属性过滤器判断value是否为null,null的话就过滤掉。(出现问题再找其他解决方案)
总结:
我升级的项目是基于SSH框架的,另外整合单点登录(cas)和WebService(cxf),除作上述修改调整和上述问题出现外,运行正常且没有出现其他问题,如后续出现其他问题,会继续更新。