Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8502645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:32:36+00:00 2026-06-11T01:32:36+00:00

I have got a problem with my JSF-rendering. A given condition in Expression Language

  • 0

I have got a problem with my JSF-rendering. A given condition in Expression Language will not be executed in the right way.
E.g:

Example 1

<f:param name="cat" value="#{product.category.uri}" rendered="#{product.category.parent.uri == null}" />
<f:param name="cat" value="#{product.category.parent.uri}" rendered="#{product.category.parent.uri != null}" />

Example 2

<c:if test="#{product.category.parent.uri == null}">
    <f:param name="cat" value="#{product.category.uri}" />
</c:if>

<c:if test="#{product.category.parent.uri != null}">
    <f:param name="cat" value="#{product.category.parent.uri}" />
</c:if>

Problem

In both examples, both my parameters will be added to my surrounding h:outputLink.
I am not sure what other code to add, so if you guys need anything else in order to help me, I’ll be happy to provide it.

Thanks in advance.

Example 3 (on request)

<?xml version='1.0' encoding='UTF-8' ?>

<ui:composition template="./WEB-INF/templates/base.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core">
    <ui:define name="content">
        <c:choose>
            <c:when test="#{webshop.productlist.size() > 0}">
                <div id="spacer">
                    <ui:repeat value="#{webshop.productlist}" var="product">
                        <div id="block">
                            <p>
                                <h:outputLink value="product.xhtml">
                                    #{product.name}
                                    <c:choose>
                                        <c:when test="#{product.category.parent.uri == null}">
                                            <f:param name="cat" value="#{product.category.uri}" rendered="" />
                                        </c:when>
                                        <c:otherwise>
                                            <f:param name="cat" value="#{product.category.parent.uri}" />
                                        </c:otherwise>
                                    </c:choose>
                                    <f:param name="product" value="#{product.uri}" />
                                </h:outputLink>
                            </p>
                        </div>
                    </ui:repeat>
                </div>
            </c:when>

            <c:otherwise>
                (...)
            </c:otherwise>
        </c:choose>
    </ui:define>
</ui:composition>

I have cleaned up this example a bit, but the essence is there.
I have replaced the first examples by a when/otherwise construction, whether my product.category.parent.uri is null or not, it will give me the first result in this case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:32:37+00:00Added an answer on June 11, 2026 at 1:32 am

    Your core problem is that you’re completely confusing view build time tags and view render time tags.

    The view build time is that moment when a XHTML file is to be converted to a JSF component tree as available by FacesContext#getViewRoot(). The view render time is that moment when the JSF component tree is about to produce HTML code, as initiated by UIViewRoot#encodeAll().

    All JSTL <c:xxx> tags and all JSF <ui:xxx> tags which do not have a rendered attribute run during view build time. All JSF <ui:xxx> tags which do have a rendered attribute and all JSF <h:xxx> tags run during view render time. So, they don’t run in sync as you’d expect from the coding.

    Coming back to your concrete problem, this is two-fold:

    1. The <f:param> does as being a tag handler not support the rendered attribute at all.

    2. The #{product} is in your code definied by <ui:repeat var>, which is a view render time tag, but yet you’re trying to let JSTL <c:xxx> view build time tags depend on that. This will of course not work. The #{product} is null during the view build time, simply because the <ui:repeat> hasn’t run at that moment.

    Your concrete problem can only be solved by using the view build time tag <c:forEach> instead of the view render time tag <ui:repeat> to iterate over products.

    <c:forEach items="#{webshop.productlist}" var="product">
    

    See also

    • JSTL in JSF2 Facelets… makes sense?

    Unrelated to the concrete problem, the follwing clumsy block

    <c:choose>
        <c:when test="#{product.category.parent.uri == null}">
            <f:param name="cat" value="#{product.category.uri}" rendered="" />
        </c:when>
        <c:otherwise>
            <f:param name="cat" value="#{product.category.parent.uri}" />
        </c:otherwise>
    </c:choose>
    

    can be replaced by the following simpler approach with help of the conditional operator in EL:

    <f:param name="cat" value="#{empty product.category.parent.uri ? product.category.uri : product.category.parent.uri}" />
    

    This way you must be able to keep using the <ui:repeat>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got one problem with the UITableViewController... The viewWillAppear method is not getting
I have got a problem with GridView because I do not understand how can
I have got problem while inserting some data in polish language(characters like ąćęłóżź) into
I have got a problem with my JSF application. On a page there's a
I'm using JSF 2.0 and Glassfish 3.1 and have the following problem: I've got
I have got a problem with two tables: CREATE TABLE IF NOT EXISTS `addresses`
I have got a problem with XmlWriter during save for example: 0.000036 value. During
I have got a problem to get back a parameter from my view to
I have got a problem with calling a global function, which takes a pointer
I have got a strange problem about in_array recently which I cannot understand. e.g.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.