Re: How to reproduce specific Friendly URL ?

Splash Forums PrettyFaces Users How to reproduce specific Friendly URL ? Re: How to reproduce specific Friendly URL ?

#20769

There’s no reason you should need to do this based on what you are telling me. I think you are over-thinking this.

Create three mappings, one for each level of your URL. Use a page-load action to load your data.

<url-mapping id="root">
<pattern value="/site/#{siteName:bean.siteName}" />
<view-id value="/faces/viewSite.jsf" />
<action>#{bean.loadSite}</action>
</url-mapping>
<url-mapping id="channel">
<pattern value="/site/#{siteName:bean.siteName}/#{channelName:bean.channelName}" />
<view-id value="/faces/viewChannel.jsf" />
<action>#{bean.loadChannel}</action>
</url-mapping>
<url-mapping id="subChannel">
<pattern value="/site/#{siteName:bean.siteName}/#{channelName:bean.channelName}/#{subChannel:bean.subChannelName}" />
<view-id value="/faces/viewSubChannel.jsf" />
<action>#{bean.loadSubChannel}</action>
</url-mapping>

Then use <h:link> with <f:param value=”#{bean.channelName}”> … etc, not the ID. Just like you would normally.

Note: You MUST do the conversion from Name -> ID, *yourself*, in the <action> methods; that is where you load the data.