请问有没有 对mvc入口函数的参数 进行必录强制校验的功能?
5 回复
感谢 但是我配置了使用怎么都不起任何作用,errors参数始终为null,在nutzwk-mvc-chain.json中也配置了ValidationProcessor,麻烦看一下
@At("/getUserInfo")
@Ok("json")
public Object getUserInfo(@Validations(required = true, errorMsg = "userid is required")String userid, @Param("clientId")String clientId, Errors errors) {
try {
//Subject subject = SecurityUtils.getSubject();
Sys_user curUser = sysUserService.fetch(userid);
if (curUser != null) {
return Result.success("system.success", sysUserService.getUserInfo(curUser,clientId));
}
throw new ValidatException("参数不正确!");
} catch (Exception e) {
e.printStackTrace();
return Result.error("system.error", e);
}
}
var chain={
"default" : {
"ps" : [
"cn.wizzer.app.web.commons.processor.LogTimeProcessor",
"cn.wizzer.app.web.commons.processor.GlobalsSettingProcessor",
"org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor",
"org.nutz.mvc.impl.processor.EncodingProcessor",
"org.nutz.mvc.impl.processor.ModuleProcessor",
"cn.wizzer.app.web.commons.processor.NutShiroProcessor",
"cn.wizzer.app.web.commons.processor.XssSqlFilterProcessor",
"org.nutz.mvc.impl.processor.ActionFiltersProcessor",
"org.nutz.mvc.impl.processor.AdaptorProcessor",
"org.nutz.mvc.impl.processor.MethodInvokeProcessor",
"org.nutz.mvc.impl.processor.ViewProcessor",
"org.nutz.plugins.validation.ValidationProcessor"
],
"error" : 'org.nutz.mvc.impl.processor.FailProcessor'
}
};
添加回复
请先登陆