isValidationFailed默认值 [英] isValidationFailed default value

查看:106
本文介绍了isValidationFailed默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果验证失败,则在渲染响应阶段之后,方法facesContext.isValidationFailed()将返回什么?在这种情况下,它将为我返回false.

What would the method facesContext.isValidationFailed() return after the Render Response Phase when the validation fails? It returns false for me in this case.

推荐答案

仅当

It will only return true when FacesContext#validationFailed() has been called by the JSF validation internals or by your own code as follows:

FacesContext.getCurrentInstance().validationFailed();

就JSF内部代码而言,仅

As far JSF internal code is concerned, only UIInput#processValidators() and UIViewParameter#processValidators() will implicitly call this method whenever a ValidatorException has been caught.

如果它为您返回false,那么您显然正在以非标准方式进行验证.例如,在操作方法内部,当您应该使用真实的 Validator .

If it returns false for you, then you're apparently doing validation in a non-standard way. For example inside the action method, while you should be using a real Validator for this.

这篇关于isValidationFailed默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆