using PF 3.3.1, PrettyFaces 3.3.3 and JSF/Mojarra2.1.
I have a custom navigation handler to handle "cancel" button on my application pages - the cancel button needs to return to the previous (referring) page. I have implemented a stack-based solution that holds the trail of the user's navigation and almost finished implementing the navigationHandler - but now I've hit a snag. I can't seem to get the cancel action to navigate back to the page I want. I've tried the following:
FacesContext.getCurrentInstance().redirect
within my NavigationHandler.handleNavigation.
So next I tried something like (again, in the NavigationHandler.handleNavigation):
BreadCrumbStack.NavDetail navDetail = breadCrumbStack.popLastCrumb(facesContext);
if (navDetail != null) {
navDetail.getPrevViewId() + " ActionMethod: " + navDetail.getActionMethod() + " ActionName: " + navDetail.getActionName());
facesContext.getViewRoot().setViewId(navDetail.getPrevViewId());
parentHandler.handleNavigation(fc, navDetail.getActionMethod(), navDetail.getActionName());
return;
}
Now the problem is that the URLMapping (pretty faces 3.3.2) - is complaining that there is no ID, which is required:
PrettyException: Exception occurred while building URL for Mapping Id Required value was null
I have the full URL with ID at the end of it - which I wanted to use in my redirect - however, it seems that the redirect isn't working correctly from within my custom navigationHandler's handleNavigation method.
Does anyone have any ideas about how I might be able to elegantly solve this problem? the IDs/params tacked onto the end of the url can vary for each screen, and I don't particularly want to hack a solution together - it would be nice if somehow I could just give the url to some predefined class in PrettyFaces and it would work OR do a complete redirect (which I couldn't get to work)
Thanks in advance for your help!