[ACCEPTED]-FacesContext.getCurrentInstance().getExternalContext().redirect does not redirect immediately-redirect

Accepted answer
Score: 20

Yes, simply return from the method:

FacesContext.getCurrentInstance()
   .getExternalContext().redirect("DisplayList.jsf");
return;

When you invoke 4 redirect(..) the only thing that happens is that a special 3 header (Location) is set in the response object. But 2 the flow of the invoking method continues, unless 1 you return from it after you call redirect.

More Related questions