升级到Struts 2.3.32问题-struts2校验文件不起作用

最近又要修复struts2 s045漏洞,之前漏的一个系统
按照之前的教程,替换为以下jar包:
struts2-core-2.3.32.jar
struts2-json-plugin-2.3.32.jar 
xwork-core-2.3.32.jar
ognl-3.0.19.jar 

freemarker-2.3.22.jar
struts2-spring-plugin-2.3.32.jar
jar包下载地址 http://download.csdn.net/detail/u010050174/9782713

替换完毕后报错:
java.lang.InstantiationError: com.opensymphony.xwork2.util.finder.ClassFinder


发现项目中还存在:
struts2-convention-plugin-2.3.16.jar
struts2-embeddedjsp-plugin-2.3.16.jar
可能换是版本问题
所以继续替换为:struts2-convention-plugin-2.3.32.jar
启动后 项目正常了
后来想,项目可能没有用到这个两个jar包。
就删除以上两个jar
项目依旧正常。
替换完毕后,登陆其他正常,但是 struts2校验文件不起作用,
也就是validation.xml文件 ,对前台参数不起作用了。

正常思路:
项目以前是可以进行校验的,那问题出在替换jar包之后,就是新jar特性问题导致
解决方案:
validation.xml 内容做些修改
1、开头DTD解释文档替换
替换为:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE validators PUBLIC
"-//Apache Struts//XWork Validator 1.0.3//EN"
"http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">

2、expression 改为regex


更改后,项目校验文件可以正常。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
==================================================================== * 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 [email protected] . * * 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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值