apzl_leasing/WebContent/Frame/page/ow/ValidClassIgnoreEmpty.jsp
2018-06-03 22:26:41 +08:00

46 lines
1.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page language="java" contentType="text/html;charset=GBK"%><%@
page import="java.sql.*"%><%@
page import="java.util.*"%><%@
page import="com.amarsoft.are.ARE"%><%@
page import="com.amarsoft.awe.dw.ui.validator.ICustomerRule"%><%
String sClass = request.getParameter("ClassName");
String sValue = java.net.URLDecoder.decode(request.getParameter("Value"),"UTF-8").replaceAll("⊙≌□","&");
if(sValue.equals("")){
out.print("true");
return;
}
//拼接参数
Hashtable params = new Hashtable();
for(java.util.Enumeration enum1 = request.getParameterNames(); enum1.hasMoreElements();){
String sKey = (String)enum1.nextElement();
//System.out.println("sKey=" + sKey);
if(sKey.equals("ClassName"))continue;
if(sKey.equals("Value"))continue;
if(request.getParameter(sKey)!=null){
String sParamValue = java.net.URLDecoder.decode(request.getParameter(sKey).toString(),"UTF-8");
params.put(sKey,sParamValue.replaceAll("⊙≌□","&"));
//System.out.println("参数:" + sParamValue);
}
}
ARE.getLog().trace("开始Class验证接收参数sClass=" + sClass + "|value=" + sValue);
try{
if(sClass!=null){
ICustomerRule rule = (ICustomerRule)Class.forName(sClass).newInstance();
String sResult = rule.valid(sValue,params);
if(sResult.equals("")){
out.print("true");
//ARE.getLog().info("true");
}else{
out.print(sResult);
//ARE.getLog().info(sResult);
}
}else{
out.print("未定义校验类");
//ARE.getLog().info("false");
}
}catch(Exception e){
e.printStackTrace();
ARE.getLog().error("class校验【忽略空】出错了"+e.toString());
out.print("出错了:"+e.toString());
}
%>