Re: Menu link to the currently viewed page

Splash Forums PrettyFaces Users Menu link to the currently viewed page Re: Menu link to the currently viewed page

#21732

Piotr Findeisen
Participant

This is because in PrettyViewHandler.getActionURL there is a code like this:

@Override
public String getActionURL(final FacesContext context, final String viewId)
{
PrettyContext prettyContext = PrettyContext.getCurrentInstance(context);
if (prettyContext.isPrettyRequest() && !prettyContext.isInNavigation() && (viewId != null)
&& viewId.equals(context.getViewRoot().getViewId()))
{
URL url = prettyContext.getRequestURL();
QueryString query = prettyContext.getRequestQueryString();
String contextPath = prettyContext.getContextPath();

String target = contextPath + url + query.toQueryString();
return target;
}
else
{
return parent.getActionURL(context, viewId);
}
}

The if catches, because prettyContext.isInNavigation() returns false — my application provides its own navigation handler, which calls:

acesContext.getApplication().getViewHandler().getActionURL(facesContext, viewId)