如何使用 Primefaces 的 p:growl 并重定向到页面 [英] How to use Primefaces' p:growl and redirect to a page

查看:29
本文介绍了如何使用 Primefaces 的 p:growl 并重定向到页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 jsf 环境的新手,我正在尝试更新 Primefaces 咆哮,然后从 commandButton 操作重定向到页面.

hi im kind of new at jsf enviroment, im trying to update a primefaces growl and then redirect to a page from a commandButton action.

 <p:commandButton value="Guardar"  action="#{AgendamientoMBean.procesaAgendamientoJ()}" 
 update="growlDetalle" />  

托管 bean 代码其

The managed bean code its

   FacesContext context = FacesContext.getCurrentInstance();
   context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, descripcion, detalle));
   ....
   ....
    return "agp_bandeja_citas_llamadas?faces-redirect=true";

这只是重定向到页面,但没有向我显示咆哮消息,我测试了如果改变我的方法不返回页面消息确实显示..

This only redirectme to the page but doesnt show me the growl message, i tested that if change my method to not return the page the message does show..

我试图更新我重定向的页面的咆哮声,但我猜那是不可能的.

I was trying to update the growl of the page that im redirecting but thats impossible i guess.

我认为重定向时我失去了更新功能,因为我现在在新页面中.

i think that when redirecting i lost the update functionality because im in new page now.

有没有办法告诉 jsf 先更新然后重定向?

Is there a way to tell jsf to first do the update and then redirecting?

希望你能帮助我,提前致谢

Hope you can help me, thanks in advance

推荐答案

消息在重定向过程中丢失.您可以使用闪光灯保存消息.

Messages get lost during redirect. You can use the flash to keep messages.

在从您的操作方法返回之前添加以下内容:

Add the following before returning from your action method:

FacesContext context = FacesContext.getCurrentInstance();
context.getExternalContext().getFlash().setKeepMessages(true);

这篇关于如何使用 Primefaces 的 p:growl 并重定向到页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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