Jsp 显示标记并选择c标记

Jsp 显示标记并选择c标记,jsp,displaytag,Jsp,Displaytag,我使用以下代码。但它总是处于相反的状态。我检查了值,这些值正确地从java传递到jsp。有遗漏的地方吗 <c:when test="${pCount > 0}"> <display:column class="colPCount" property="pCount " title="${titlePCount}" sortable="true" headerClass="sortable" /> </c:when> <c:otherwise

我使用以下代码。但它总是处于相反的状态。我检查了值,这些值正确地从java传递到jsp。有遗漏的地方吗

<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>

- 
对于pcount>0项,在显示标记中仍显示为“-”。甚至我也会反转检查条件,比如pCount -
我认为您可能错误地使用了显示标记库

看起来您要做的是,如果值大于零,则显示
行.pCount
,否则显示
-
。但实际上,您要做的是告诉库根据某些内容以不同的方式显示整个列(
pCount
,它可能不在您引用它的范围内……或者您必须向我们显示更多的代码)

试着这样做:

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

- 

我猜变量
pCount=null
。试着检查
${notempty pCount and pCount>0}

这样试试:
${itemList.pCount>0}

我厌倦了。仍然是一样的:(只有一件事:pCount不会有空值。在我尝试了之后,它仍然显示相同的结果。我只是在标记之前和之后添加开始和结束标记。告诉我们您在哪里设置
pCount
以便在比较中使用当我像这样使用显示标记的id时,它会工作。
<display:column class="colPCount" title="${titlePCount}" sortable="true" headerClass="sortable">
    <c:choose>
        <c:when test="${row.pCount > 0}">
            <c:out value="${row.pCount}" />
        </c:when>
        <c:otherwise>
            &nbsp;-&nbsp;
        </c:otherwise>
    </c:choose>
</display:column>