为什么validate remote验证时,后台获取不了参数

rules : {

'oldpwd' : {

required : true,

remote : {

url : '${base}/member/index/checkpwd.htm',

type : 'post'

}

},


@RequestMapping("/member/index/checkpwd.htm")
public void checkpwd(HttpServletRequest request,HttpServletResponse response,ModelMap model)throws Exception{
JSONObject json = new JSONObject();
String user_id= request.getParameter("user_id");
String oldpwd = request.getParameter("oldpwd");
S_gr_member member = null;
try {
S_gr_memberDelegate dg = new S_gr_memberDelegate();
member = dg.get(user_id);
if (member == null || !member.getUser_pwd().equals(pwdEncoder.encodePassword(oldpwd))){
ResponseUtils.renderText(response,"false");
}else{
ResponseUtils.renderText(response,"true");
}

    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

2个回答

而且在remote里面加上这句 data: { oldpwd: function(){return $("#oldpwd").val();}} 。调试时连方法都进不去了。

改htm后缀,有可能是这个影响,排除这个有可能就是权限拦截

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问