Search code examples
jspdisplaytag

display tag and c choose tag


I use the following code. But it is always go to the otherwise condition. I checked the value , and those are correctly passed from java to the jsp. Any missing points?

<c:when test="${pCount > 0}">
    <display:column class="colPCount" property="pCount " title="${titlePCount}" sortable="true" headerClass="sortable" />
</c:when>
<c:otherwise>
    <display:column class="colPCount" title="${titlePCount}">&nbsp;-&nbsp;</display:column>
</c:otherwise>

For the pcount>0 items, still displaying as '-' in the display tag. Even I reverse the checking condition like pCount<0 in the first condition checking, the display tag always show the otherwise condition. It always pointing to the otherwise condition for every value.

Edited: Full Code

    <display:table class="displayTable" id="itemList"
        name="${sessionScope.itemList}" requestURI="listItem.action"
        pagesize="15" defaultsort="2" defaultorder="ascending" sort="list">
        <display:column class="colItemName" property="name"
            title="${titleItemName}" sortable="true" headerClass="sortable"/>
        ...
        <c:choose>
        <c:when test="${pCount > 0}">
            <display:column class="colPCount" property="pCount " title="${titlePCount}" sortable="true" headerClass="sortable" />
        </c:when>
        <c:otherwise>
            <display:column class="colPCount" title="${titlePCount}">&nbsp;-&nbsp;</display:column>
        </c:otherwise>
        </c:choose>
    </display:table>

Solution

  • Try this way: ${itemList.pCount>0}