0

我使用 Jsf 1.2 并有重定向导航规则,我的问题是如何添加请求参数以查看重定向

4

1 回答 1

1

这在 JSF 1.x 中使用导航规则是不可能的。改为使用ExternalContext#redirect()

public void action() throws IOException {
    // ...

    ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
    String url = ec.getRequestContextPath() + "/page.jsf?someparam=" + URLEncoder.encode(someparam, "UTF-8");
    ec.redirect(url);
}
于 2013-10-30T12:48:11.307 回答