我正在尝试根据 boolean 字段的值显示 html 标签。使用 modelAttribute
将值从 Spring Controller 传递到 View 。
代码片段如下:
<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 属性中作为 boolean 值正确传递。这里可能存在什么问题?
最佳答案
您是否尝试过:
<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>
关于java - 在 JSTL 中传递 boolean 值时,无法加载资源:net::ERR_INCOMPLETE_CHUNKED_ENCODING,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55447985/