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

查看:186
本文介绍了如何使用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代码

   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天全站免登陆