【发布时间】:2025-02-20 10:50:02
【问题描述】:
我已经盯着下面嵌套的标签大约一个小时了,但我仍然不明白为什么我一直收到JspTagException:
"Illegal use of <when>-style tag without <choose> as its direct parent"
在JSTL中不允许嵌套这么深的条件标签吗?
<c:choose>
<c:when test="${rec.image1Available}">
<img alt="altname" src="/img1.jpg" alt="altname" />
<c:otherwise>
<c:choose>
<c:when test="${rec.image2Available}">
<img alt="altname" src="/img2.jpg" alt="altname" />
<c:otherwise>
<c:choose>
<c:when test="${rec.image3Available}">
<img alt="altname" src="img3.jpg" alt="altname" />
<c:otherwise>
<img alt="altname" src="/holder.jpg" alt="altname" />
</c:otherwise>
</c:when>
</c:choose>
</c:otherwise>
</c:when>
</c:choose>
</c:otherwise>
</c:when>
</c:choose>
【问题讨论】: