Question

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

Was it helpful?

Solution

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);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top