【发布时间】:2014-10-22 20:42:27
【问题描述】:
我是第一次进行 JSTL 编码,我在使用 if else 条件(c:when 和 c:choose)时遇到了一些问题
我需要的if else嵌套的伪代码是
if(${not empty properties['userrgba']}){
<div style = "background-color: ${properties['userrgba']};">
}
else if({not empty properties['userColor']})
{
if({not empty properties['userColorGradient']}){
<div style = "background-color: ${properties['userColor']};
background: -webkit-gradient(linear, left top, left bottom, color-stop(50%, ${properties['userColorGradient']}));" >
}
else{
<div style = "background-color: ${properties['userColor']};">
}
} //END ELSE IF
else{
<div class = ${properties['color']}>
} //END ELSE
我的 JSTL if 循环是
<c:choose>
<c:when test="${not empty properties['userrgba']}">
<div style = "background-color: ${properties['userrgba']};">
</c:when>
<c:otherwise>
<c:choose>
<c:when test="${not empty properties['userColor']}">
<c:choose>
<c:when test="${not empty properties['userColorGradient']}">
<div style = "background-color: ${properties['userColor']};
background: -webkit-gradient(linear, left top, left bottom, color-stop(50%, ${properties['userColorGradient']}));">
</c:when>
<c:otherwise>
<div style = "background-color: ${properties['userColor']};">
</c:otherwise>
</c:choose>
</c:when>
</c:choose>
<c:otherwise> //<-- this should be </c:otherwise>
<c:otherwise>
<div class = ${properties['color']}>
</c:otherwise>
我得到的错误是
/path/to/file/file_name.jsp(43,0) The end tag "</c:choose" is unbalanced
第 43 行是我最后一次做的地方。我思考了很多并进行了很多更改,但是每次发生类似错误时都是某行(与选择标签的关闭或何时标签有关)
有什么办法可以解决吗?
谢谢!
【问题讨论】: