Jsp 更好的使用方法<;c:选择>;如果有多个选项

Jsp 更好的使用方法<;c:选择>;如果有多个选项,jsp,jstl,Jsp,Jstl,我使用下面的代码来显示信息,但是我得到了jstl异常。 请提出任何替代或适当的处理方法 <div class="span3"> <c:choose> <c:when test="${fn:length(alertStatusForm.totalSentRecipient) gt 0}"> <div class="row-fluid"><div class="span12"

我使用下面的代码来显示信息,但是我得到了jstl异常。 请提出任何替代或适当的处理方法

<div class="span3">
        <c:choose>
            <c:when test="${fn:length(alertStatusForm.totalSentRecipient) gt 0}">
                <div class="row-fluid"><div class="span12"><a href="/event/alert/recipient/list/${alertStatusForm.forAlert.id}" class="underline">${fn:length(alertStatusForm.totalSentRecipient)}</a></div></div>  
            </c:when>
            <c:otherwise>
                        <label style="color:black"><spring:message code='alert.voice.time.others'/></label>
            </c:otherwise>
        </c:choose>
        <c:choose>
            <c:when test="${fn:length(alertStatusForm.totalNotSentRecipient) gt 0}">
                <div class="row-fluid"><div class="span12"><a style="color: red" href="/event/alert/recipient/list/${alertStatusForm.forAlert.id}" class="underline">${fn:length(alertStatusForm.totalNotSentRecipient)}</a></div></div>
            </c:when>
            <c:otherwise>
                <label style="color:black"><spring:message code='alert.voice.time.others'/></label>
            </c:otherwise>
        </c:choose>
        <c:choose>
            <c:when test="${fn:length(alertStatusForm.totalInProgressRecipient) gt 0}">
                <div class="row-fluid"><div class="span12"><a href="/event/alert/recipient/list/${alertStatusForm.forAlert.id}" class="underline">${fn:length(alertStatusForm.totalInProgressRecipient)}</a></div></div>
            </c:when>
            <c:otherwise>
                        <label style="color:black"><spring:message code='alert.voice.time.others'/></label>
            </c:otherwise>
        </c:choose>
</div>

我看不出这种方法有什么错。如果不想混合使用html和jstl代码,仍然可以按如下方式编写代码-

<c:set var="html1" value="<div class='row-fluid'><div class='span12'><a href='/event/alert/recipient/list/${alertStatusForm.forAlert.id}' class='underline'>${fn:length(alertStatusForm.totalSentRecipient)}</a></div></div>" />
<c:if test="${fn:length(alertStatusForm.totalSentRecipient) lt 0}">
    <c:set var="html1" value="<label style='color:black'><spring:message code='alert.voice.time.others'/></label>" />
</c:if>

<c:set var="html2" value="<div class='row-fluid'><div class='span12'><a style='color: red' href='/event/alert/recipient/list/${alertStatusForm.forAlert.id}' class='underline'>${fn:length(alertStatusForm.totalNotSentRecipient)}</a></div></div>" />
<c:if test="${fn:length(alertStatusForm.totalNotSentRecipient) lt 0}">
    <c:set var="html2" value="<label style='color:black'><spring:message code='alert.voice.time.others'/></label>" />
</c:if>

<c:set var="html3" value="<div class='row-fluid'><div class='span12'><a href='/event/alert/recipient/list/${alertStatusForm.forAlert.id}' class='underline'>${fn:length(alertStatusForm.totalInProgressRecipient)}</a></div></div>" />
<c:if test="${fn:length(alertStatusForm.totalInProgressRecipient) lt 0}">
    <c:set var="html3" value="<label style='color:black'><spring:message code='alert.voice.time.others'/></label>" />
</c:if>

<div class="span3">
    ${html1}
    ${html2}
    ${html3}
</div>

${html1}
${html2}
${html3}

那么您只想在
alertStatusForm
字段有值时显示链接?它们是什么类型的?总数对我来说是整数。你有什么例外?