How to forward to another page in a managed bean constructor? [duplicate]
How can I forward to another page inside the constr开发者_运维技巧uctor 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.
You need to invoke a method to do this. Constructors are not methods, and cannot return the "PAGE2" string.
精彩评论