0

How can I forward to another page inside the constructor of a backing bean? I don't want to use redirect.

EDIT:

Thank you very much BalusC.

Is FacesContext.getCurrentInstance().getExternalContext().dispatch("page.jsf") safe if I call it inside a getter method? The getter method will be invoked by JSF in the Render Response phase.

Community
  • 1
  • 1
anonymous
  • 11
  • 1
  • 1

1 Answers1

0

You need to invoke a method to do this. Constructors are not methods, and cannot return the "PAGE2" string.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347