Re: SEO URL supporting l10n/i18n with PrettyFaces

Splash Forums PrettyFaces Users SEO URL supporting l10n/i18n with PrettyFaces Re: SEO URL supporting l10n/i18n with PrettyFaces


Meanwhile I could test the version using PrettyFaces and in principle it works as it should with the configuration as follows:

<!-- lang -->

<url-mapping id="lang">

<pattern value="/#{languageSelected : localeHandler.languageSelected}" />


<!-- welcome -->

<url-mapping id="welcome">

<pattern value="/"/>

<view-id value="/pages/index.xhtml"/>


<!-- home -->

<url-mapping parentId="lang" id="home">

<pattern value="/"/>

<view-id value="/pages/index.xhtml"/>


<!-- company -->

<url-mapping parentId="lang" id="company">

<pattern value="/company"/>

<view-id value="/pages/company.xhtml"/>


<h:link value="Home"


<f:param name="languageSelected" value="#{localeHandler.languageSelected}"/>


<h:link value="Company"


<f:param name="languageSelected" value="#{localeHandler.languageSelected}"/>


Examples of the resulting URL are:




There are two little drawbacks.

  1. The mapping “lang” becomes highlighted by the IDE (IntelliJ IDEA) and a error message becomes shown as follows:

    “The content of element “url-mapping” is not complete. One of ‘{“”:query-param, “http://ocpsoft.vom/prettyfaces/3.3.3″:view-id}” is expected.”

  2. It’s a lot of work to equip each h:link with <f:param name="languageSelected" value="#{localeHandler.languageSelected}"/>
  3. However, if it works it would be worth to do the effort.

    In that case, is there a chance to get rid of the trailing “/” in case of http://localhost:8080/en/ for the localized welcome page?

    Now I’m curious about trying the version with Rewrite.

    Kind regards

    Stephan Rudolph