Pretty:link current page mappingId

Splash Forums PrettyFaces Users Pretty:link current page mappingId

This topic contains 3 replies, has 2 voices, and was last updated by  Christian Kaltepoth 9 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #18434



    I’m doing a Web application using Spring 3.1.0.RELEASE, JSF 2.x, JPA 2 with Hibernate Provider. The application run on Tomcat 7.27.

    I use PrettyFaces 3.3.3 for url management.

    Here my problem:

    I have a template that contains pretty:link(s) that allow to the users to change the lang of the current page. For the moment I change the lang and redirect to home.

    <ui:repeat ....>

    <pretty:link mappingId="home" styleClass="langue">

    <f:param value="#{acceptedLanguage}" />

    <f:param value="#{siteManager.visualId}" />#{acceptedLanguage}



    I have different pages that implement the template. I would like to stay on the same page and only change the lang. The problem is that pretty:link required a mappingId.

    My url look like this:

    <url-mapping id="themes">

    <pattern value="/themes/#{lang : prettyUrlManager.urlLangId}/#{siteId : prettyUrlManager.urlSiteId}" />

    <view-id value="/theme/themes.jsf" />



    <url-mapping id="siteSettings">

    <pattern value="/siteSettings/#{lang : prettyUrlManager.urlLangId}/#{siteId : prettyUrlManager.urlSiteId}" />

    <view-id value="/admin/siteSettings.jsf" />

    <action onPostback="false">#{prettyUrlManager.processSiteSettings}</action>


    For sure I can implement this ui:repeat in my template and use the specific view-id, but is it possible to said stay on the same view id, just change param ?

    Something like this :

    <ui:repeat ....>

    <pretty:link mappingId="wildCardCurrentView" styleClass="langue">

    <f:param value="#{acceptedLanguage}" />

    <f:param value="#{}" />#{acceptedLanguage}





    You can get the ID of the current mapping with this code:


    So you could do something like this:

    public class MappingBean {
    public String getCurrentMappingId() {
    return PrettyContext.getCurrentInstance().getCurrentMapping().getId();

    And then use the value like this:

    <pretty:link mappingId="#{mappingBean.currentMappingId}">

    I hope this helps! :)



    Great it’s exactly what I was looking for!

    I really like this project, it’s stable and maintain, easy to use, well documented.

    Moreover the team is available and always friendly to answer user request. Your technology should be integrated in JSF 3!

    Thanks you PrettyFaces team!


    Thanks! :)

    I’m glad you like it. :)

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.