我在jsp页面传人一个参数到后台,便于后台代码标记,根据这个标记进行执行不同的方法,然后把这个标记返回到页面;这个标记就要进行验证,放在被***;

如:

wKioL1UQNhTDsu_aAADZtkggfYo939.jpg

解决办法:

jsp:

if(status == 0){     //待支付
     $("#tab_0").load("/detailsOfFunds.do?details&type="+status+"&      direction="+$("#direction${status}").val()
                +"&date="+$("#dateQ${status}").val()+"&pageNo="+pageno);
}


java:

String type=request.getParameter("type");
        if(type !=null && !"".equals(type)){
            if(Validate.isNum(type)){  //进行过滤
                type="0";
            }
}


Validate:

public static boolean isNum(String str) throws PatternSyntaxException {
            // 只允许字母和数字
            String regEx = "[^-0-9]";
            Pattern p = Pattern.compile(regEx);
            Matcher m = p.matcher(str);
            String filter = m.replaceAll("").trim();
            if (!filter.equals(str)) {
                return true;
            } else {
                return false;
            }
        }