How can you redirect a user by URL (within backing bean) to some other page within portlet? We are using GateIn 3.1 on JBoss 5.1.0
Usually, FacesContext.getCurrentInstance().getExternalContext().redirect("url")
is enough, but here it doesn't work, it doesn't redirect user.
context.getApplication().getNavigationHandler().handleNavigation(context, null, page)
doesn't work either.
We want to avoid making navigation rules for every possible page we can redirect to.
EDIT:
It appears a4j:commandButton
was causing some problems, after we replaced it with h:commandButton
we are being redirected but not only within portlet but within portal.
The only other alternative (to having many navigation cases in faces-config.xml
) I've found that works is using FacesContext.getCurrentInstance().getViewRoot().setViewId(page)
to redirect, where page is String page = FacesContext.getCurrentInstance().getViewRoot().getViewId()
.