isValidationFailed default value

北战南征 提交于 2021-02-19 04:31:32

问题


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


回答1:


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();

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

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.



来源:https://stackoverflow.com/questions/9474151/isvalidationfailed-default-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!