如果验证失败,如何在验证阶段的后阶段签入? [英] How to check in after phase of Validations phase if validation has failed?

查看:135
本文介绍了如果验证失败,如何在验证阶段的后阶段签入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个PhaseListener,我正在其中检查验证"阶段.有没有一种方法可以使我在侦听器的afterPhase()方法中检查验证是否失败,并且验证阶段之后的下一个阶段将是渲染响应"阶段.

I have written a PhaseListener in which I am checking for the Validations phase. Is there a way using which I can check in the afterPhase() method of listener that validation has failed and the next phase after the Validation phase will be Render Response phase.

推荐答案

如何使用FacesContext,您可以检查是否有入队消息吗?例如

How about using FacesContext, can you check if there are any enqueued messages? Eg.

FacesContext context = FacesContext.getCurrentInstance();
Iterator<FacesMessage> messages = context.getMessages();

希望有帮助.

这篇关于如果验证失败,如何在验证阶段的后阶段签入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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