myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From M Rather <mrat...@definedlogic.com>
Subject c:if test not evaluating properly in ui:repeat and t:dataTable
Date Thu, 13 Dec 2007 20:56:35 GMT
Hello,

I have a  jsf, myfaces, facelets, tomahawk, displaytag and c:forEach 
question. My apologies if you see this question in some other boards 
relevant to this discussion.

This is the issue.

I load a list of customers.. I loop  thru each of  them  using  
c:forEach, ui:repeat, displaytag and t:dataTable. All of them behave 
differently, if <c:if test is used inside the body tag.. All of them are 
incorrect except for c:forEach (there may be a different problem with 
display tag, as I can't get it to show up in this page.)

Below is the code for the page.. and the result follows it. The code is 
self explanatory and the results show the discrepancy. I would 
appreciate if someone could point out what I may be doing wrong, or if I 
am not understanding how t:dataTable or ui:repeat works... Are there 
issues with c:if evaluation at compile time versus runtime? Is there any 
remedy to this?

Thanks
MRather

customerList.xhtml
===============================CODE BEGIN
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:t="http://myfaces.apache.org/tomahawk"
    xmlns:acegi="http://sourceforge.net/projects/jsf-comp/acegijsf"
    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
    xmlns:display="http://displaytag.sf.net">


    <ui:composition>
        <c:set var="customers" value="${customerList.customers}" 
scope="request" />
       
        ==================== c:forEach =================<br/>
        <c:forEach var="customer" items="${customers}" >
            <c:set var="isOneC" value="NO" />
            <c:if test="${customer.id eq 1}">
                <c:set var="isOneC" value="YES" />
            </c:if>
            ${customer.id} - ${customer.name} - ${isOneC}
            <br/>
        </c:forEach>
        ==================== c:forEach =================<br/><br/><br/>
       
       
        ==================== ui:repeat =================<br/>
        <ui:repeat var="customer" value="${customers}" >
            <c:set var="isOneUI" value="NO" />
            <c:if test="${customer.id eq 1}">
                <c:set var="isOneUI" value="YES" />
            </c:if>
            ${customer.id} - ${customer.name} - ${isOneUI}
            <br/>
        </ui:repeat>
        ==================== ui:repeat =================<br/><br/><br/>
       
        ==================== display:table =================<br/>
        <display:table name="${customers}" />
        ==================== display:table =================<br/><br/><br/>
       
        ==================== t:dataTable =================<br/>
        <t:dataTable var="customer" value="${customers}" >
            <t:column styleClass="#{row.styleClass}">
               
                <c:set var="isOneT" value="NO" />
                <crt:if test="${customer.id eq 1}">
                    <c:set var="isOneT" value="YES" />
                </crt:if>
               
                ${customer.id}   - ${isOneT}
            </t:column>
            <t:column styleClass="#{row.styleClass}">
                ${customer.name}
            </t:column>
        </t:dataTable>
        ==================== t:dataTable =================<br/><br/><br/>
       
       
        <ui:debug />
    </ui:composition>
</html>
==========================================CODE END

and below is the result. c:forEach works, but others don't


==================== c:forEach =================RESULT BEGIN
1 - cust1- YES
2 - cust2 - NO
3 - cust3 - NO
4 - cust4- NO
5 - cust5 - NO
6 - cust6 - NO
7 - cust7 - NO
8 - cust8 - NO
9 - cust9- NO
==================== c:forEach =================


==================== ui:repeat =================
1 - cust1- NO
2 - cust2 - NO
3 - cust3 - NO
4 - cust4- NO
5 - cust5 - NO
6 - cust6 - NO
7 - cust7 - NO
8 - cust8 - NO
9 - cust9 - NO
==================== ui:repeat =================


==================== display:table =================
==================== display:table =================


==================== t:dataTable =================
1 - YES    cust1
2 - YES    cust2
3 - YES    cust3
4 - YES    cust4
5 - YES    cust5
6 - YES    cust6
7 - YES    cust7
8 - YES    cust8
9 - YES    cust9
==================== t:dataTable =================RESULT END




Mime
View raw message