Domanda

i use Jsf 1.2 and have navigation rule with redirect, my question is how to add request parameters to view redirected

È stato utile?

Soluzione

This isn't possible using navigation rules in JSF 1.x. Use ExternalContext#redirect() instead.

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);
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top