在 JSTL 中传递布尔值时无法加载资源:net::ERR_INCOMPLETE_CHUNKED_ENCODING



>我正在尝试根据布尔字段的值显示html标签。该值使用 modelAttribute 从 Spring 控制器传递到视图。

代码片段如下:

  <div>
    <span class="main-text">Vat</span>:
       <span class="sub-text">
           <c:if test="${businessOrder.isVat ne null}">
              <span class="label label-medium ${businessOrder.isVat ? 'label-success' : 'label-danger'}">
                 ${businessOrder.isVat ? 'True' : 'False'}
               </span>
           </c:if>
    </span>
  </div>

当我通过这个时,我收到上述错误,页面无法正确加载。但是,该值在 businessOrder 属性中作为布尔值正确传递。这里可能有什么问题?

你有没有尝试过:

  <div>
    <span class="main-text">Vat</span>
       <span class="sub-text">
           <c:if test="${businessOrder.isVat ne null}">
              <c:choose>
                  <c:when test="${businessOrder.isVat == true}"><span class="label label-medium label-success">'True'</span></c:when>
                  <c:otherwise><span class="label label-medium label-danger">'False'</span></c:otherwise>
              </c:choose>
           </c:if>
      </span>
  </div>

最新更新