Same parameters getting used irrespective of which pretty link I click

Splash Forums PrettyFaces Users Same parameters getting used irrespective of which pretty link I click

This topic contains 1 reply, has 2 voices, and was last updated by  Christian Kaltepoth 5 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #18023

    S
    Participant

    I have this JSF page where I am displaying two sets of links (categories and dietChoices). Depending on which link the user clicks, different values/parameters are passed to the url.

    <div class=”foyo-food-filter”>

    <div class=”foyo-category-filter”>

    <h3>#{bundle.FoodGroups}</h3>

      <ui:repeat value=”#{staticCacheManager.allCategories}” var=”category”>

    • <h:link value=”#{category.categoryName}” outcome=”pretty:findProductByCategory”>

      <f:param name=”displayType” value=”foodgroup”/>

      <f:param name=”categoryName” value=”#{cx:encodeWithDash(category.categoryName)}”/>

      <f:param name=”categoryId” value=”#{category.categoryId}”/>

      </h:link>

    • </ui:repeat>

    </div>

    <div class=”foyo-nutrient-filter”>

    <h3>#{bundle.ListNutrientTitle}</h3>

      <ui:repeat value=”#{staticCacheManager.dietChoices}” var=”nutrient”>

    • <h:link value=”#{nutrient.dietChoiceDescription}” outcome=”pretty:findProductByNutrient”>

      <f:param name=”displayType” value=”dietchoice”/>

      <f:param name=”dietChoice” value=”#{cx:encodeWithDash(nutrient.dietChoiceDescription)}”/>

      <f:param name=”nutrientNumber” value=”#{nutrient.nutrientNumber}”/>

      </h:link>

    • </ui:repeat>

    </div>

    </div>

    In the pretty-config.xml I have two url mappings both going to the same page

    <url-mapping id=”findProduct”>

    <pattern value=”/food/” />

    <view-id value=”/food.jsf” />

    </url-mapping>

    <url-mapping id=”findProductByCategory” parentId=”findProduct”>

    <pattern value=”#{displayType:foodManager.displayType}/#{categoryId:foodManager.categoryId}/#{categoryName}/” />

    <view-id value=”/food.jsf” />

    </url-mapping>

    <url-mapping id=”findProductByNutrient” parentId=”findProduct”>

    <pattern value=”#{displayType:foodManager.displayType}/#{nutrientNumber:foodManager.nutrientNumber }/#{dietChoice}/”/>

    <view-id value=”/food.jsf” />

    </url-mapping>

    Also in the food.jsf I have the metadata params

    <f:metadata>

    <f:viewParam name=”categoryId” value=”#{foodManager.categoryId}” />

    <f:viewParam name=”nutrientNumber” value=”#{foodManager.nutrientNumber}” />

    </f:metadata>

    But when I check in the managed bean behind the food.jsf

    categoryParam = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(“categoryId”);

    nutrientNumber = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(“nutrientNumber”);

    Even when I clicked findProductByNutrient link, the parameter nutrientNumber does not seem to get passed. For some reason the value passed for nutrientNumber gets set to categoryId. Am I doing anything wrong?

    #21338

    Could you tell us which PrettyFaces version you are using? And which container and JSF implementation (and their version)?

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

You must be logged in to reply to this topic.

Comments are closed.