Iam getting the status message from the action class.Based on the status message iam displaying the two different images.
If the Status message is "Acces denied" then it show one image in the JSP page. Else we want to show an different Image.
在 jstl 中没有像 if else 这样的条件,而不是 jstl 提供以下条件
<c:choose>
<c:when test="${condition1}">
...
</c:when>
<c:when test="${condition2}">
...
</c:when>
<c:otherwise>
...
</c:otherwise>
</c:choose>
有关更多详细信息,请参阅此链接
JSTL 带有<c:choose>
,<c:when>
和<c:otherwise>
标签来实现if-then-else
JSP 中的类型逻辑。查看JSTL Core 选择标签以获取基本示例。
<c:choose>
<c:when test="${a boolean expr}">
<!-- // do something -->
</c:when>
<c:when test="${another boolean expr}">
<!-- // do something else -->
</c:when>
<c:otherwise>
<!-- // do this when nothing else is true -->
</c:otherwise>
</c:choose>