struts2.3升级到struts2.5

struts2.3升级到struts2.5

<本文是struts2.3.35升级到struts2.5.30>
一、jar包说明:
struts2.5版本struts2-core包包含了xwork-core,所以此处删除了2.3版本中的xwork-core-2.3.35.jar
替换jia包:
1.struts2-spring-plugin-2.5.30.jar
2.struts2-junit-plugin-2.5.30.jar
3.struts2-json-plugin-2.5.30.jar
4.struts2-core-2.5.30.jar
5.ognl-3.1.29.jar
6.commons-lang3-3.8.1.jar
新增jar包:log4j-api-2.8.2.jar
删除jar包:xwork-core-2.3.35.jar
![在这里插入图片描述](https://img-blog.csdnimg.cn/6d9238f431f24495a119dc8c62543787.png
在这里插入图片替换描述
二、修改web.xml,去除.ng(因为2.5的目录变了)
2.3版本:

 <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

2.5版本修改为

<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>

三、修改struts.xml及相关struts文件
在这里插入图片描述

1、头部信息2.3改为2.5改为:

 <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" "http://struts.apache.org/dtds/struts-2.5.dtd">

2.增加动态方法调用开关

<constant name="struts.enable.DynamicMethodInvocation" value="true" />

3.在所有package标签上增加允许方法被调用开关strict-method-invocation=“false”

<struts>
	<package name="XXXX" namespace="/XXXX" extends="XXXX" strict-method-invocation="false">
		<action name="XXXX" class="xxxx" method="xxxx">
		</action>
	<package>
</struts>

四、修改jsp标签(dtd)
<如果使用次标签才需要修改>
1、将<s:set name 改为<s:set var
2、<s:property escape改为<s:property escapeHtml

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
==================================================================== * The OpenSymphony Software License, Version 1.1 * * (this license is derived and fully compatible with the Apache Software * License - see http://www.apache.org/LICENSE.txt) * * Copyright (c) 2001-2004 The OpenSymphony Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * OpenSymphony Group (http://www.opensymphony.com/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "OpenSymphony" and "The OpenSymphony Group" * must not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact license@opensymphony.com . * * 5. Products derived from this software may not be called "OpenSymphony" * or "XWork", nor may "OpenSymphony" or "XWork" appear in their * name, without prior written permission of the OpenSymphony Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIB

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值