如何以编程方式进行JSF内部页面转发? [英] How to programmatically do JSF internal page forward?

查看:80
本文介绍了如何以编程方式进行JSF内部页面转发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某些情况下(例如发生异常时),如何在托管bean中以编程方式转发JSF内部页面?我不想在转发到其他页面时更改URL.

How to do JSF internal page forward programatically in managed bean, on some condition (like whenever an exception occurs)? I do not want to change the URL while forwarding to other page.

现在,我使用此功能以编程方式重定向到另一个页面,但这会更改URL.

Right now I redirect to another page programmatically using this, but this changes the URL.

FacesContext.getCurrentInstance().getExternalContext().redirect();

推荐答案

尝试一下:

public void forward(){
    String uri = "destination.xhtml";
    FacesContext.getCurrentInstance().getExternalContext().dispatch(uri);
}

这篇关于如何以编程方式进行JSF内部页面转发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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