使用primefaces spring创建到另一个页面的重定向链接

时间:2015-01-09 09:51:08

标签: java spring primefaces

我想使用primefaces创建一个到另一个页面的重定向链接,spring:

if (true condition) {
     //redirect to page
} else {
     //keep the current page
     //open dialog
}

感谢。

2 个答案:

答案 0 :(得分:0)

试试这个

if( true condition ) {
    HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
    response.sendRedirect("www.google.pl");
}

答案 1 :(得分:0)

if (condition is true) {
    ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
    externalContext.redirect("other-page.xhtml");
}
else {
    RequestContext context = RequestContext.getCurrentInstance();
    context.execute("myDialog.show();"); //assuming you have set the widgetVar on your dialog to "myDialog"
}