Re: Issue : pretty:link trailing '?'

Splash Forums PrettyFaces Users Issue : pretty:link trailing '?' Re: Issue : pretty:link trailing '?'

#22632

Ah, now I got it. Sorry.

Actually the mappingId for which you are rendering the URL is dynamic. So the value of an <f:param> gets only null if it isn’t used in the mapping at all. Right? So this explains why PrettyFaces isn’t complaining about path parameters being null.

So the root cause of the problems is that you have sometimes more <f:param> then required of the mappingId to be rendered.

I think this cannot be fixed easily in PrettyFaces. The problem is that the <f:param> components must match the parameters of the mapping. But that’s difficult to achieve in your use case.

One workaround for you would be to have multiple <pretty:link> which get rendered depending on which path parameters are null. Something like this:

<!-- one path parameter -->
<h:panelGroup rendered="#{prettyManager.urlSiteId == null and prettyManager.urlThemeId == null}">
<pretty:link mappingId="#{prettyManager.currentMappingId}" rendered="#{prettyManager.currentMappingId ne 'emptyhome'}" styleClass="langue">
<f:param value="#{acceptedLanguage}"/>
#{acceptedLanguage}
</pretty:link>
</h:panelGroup>

<!-- three path parameters -->
<h:panelGroup rendered="#{prettyManager.urlSiteId != null and prettyManager.urlThemeId != null}">
<pretty:link mappingId="#{prettyManager.currentMappingId}" rendered="#{prettyManager.currentMappingId ne 'emptyhome'}" styleClass="langue">
<f:param value="#{acceptedLanguage}"/>
<f:param value="#{prettyManager.urlSiteId}" />
<f:param value="#{prettyManager.urlThemeId}" />
#{acceptedLanguage}
</pretty:link>
</h:panelGroup>

This should work. I know it’s not a nice solution. But this would be correct usage of the pretty:link component.