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

问题描述 投票:1回答:1

我正在尝试根据布尔字段的值显示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属性中作为布尔值正确传递。这可能是什么问题?

java spring jstl modelattribute
1个回答
0
投票

你尝试过:

  <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>
© www.soinside.com 2019 - 2024. All rights reserved.