Re: h:link not rendered

Splash Forums PrettyFaces Users h:link not rendered Re: h:link not rendered

#23080

I think you should be able to fix this issue without altering the PrettyFaces archive. Just implement your own ViewHandler by implementing ViewHandlerWrapper. Something like this:

public class PortalViewHandler extends ViewHandlerWrapper {

private final ViewHandler delegate;

public PortalViewHandler( ViewHandler delegate ) {
this.delegate = delegate;
}

@Override
public String deriveViewId( final FacesContext facesContext, final String rawViewId ) {
String viewId = super.deriveViewId( facesContext, rawViewId );
if( viewId == null ) {
// TODO: your special handling here
}
return viewId;
}

@Override
public ViewHandler getWrapped() {
return delegate;
}

}

Then add your implementation to your faces-config.xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">

<application>
<view-handler>com.example.myapp.PortalViewHandler</view-handler>
</application>

</faces-config>

This should work. You implementation receives the PrettyViewHandler (or some other one if there are more) in the constructor and so you will be able to change just the behavior of this single method.