<div align="right">
<b> Connected:</b> <%=(String)session.getAttribute("CONNECTION_DBNAME")%>
</div>
答案 0 :(得分:5)
<c:if test="${sessionScope.CONNECTION_DBNAME!= null}">
Connected:${sessionScope.CONNECTION_DBNAME}
</c:if>
<c:if test="${sessionScope.CONNECTION_DBNAME== null}">
NOT CONNECTED
</c:if>
or
<c:choose>
<c:when test="${sessionScope.CONNECTION_DBNAME != null}">
Connected:${sessionScope.CONNECTION_DBNAME}
</c:when>
<c:otherwise>
NOT CONNECTED
</c:otherwise>
</c:choose>
答案 1 :(得分:1)
<div align="right">
<b> Connected:</b> <%=(session.getAttribute("CONNECTION_DBNAME")!=null)?(String)session.getAttribute("CONNECTION_DBNAME"): "not connected"%>
</div>
答案 2 :(得分:0)