<c:choose>
<c:when test="${username== '1' && password== '2'}">
<jsp:forward page="welcome.jsp"></jsp:forward>
</c:when>
<c:otherwise>
<jsp:forward page="fail.jsp"></jsp:forward>
</c:otherwise>
</c:choose>
when和otherwise是并列关系,相当于if和else,test是条件语句.条件语句判断只能用"&&" "||"
<c:choose>
<c:when test="${username== '1'}">
3 <c:if test="${password== '2' }">
<jsp:forward page="welcome.jsp"></jsp:forward>
</c:if>
</c:when>
<c:otherwise>
<jsp:forward page="fail.jsp"></jsp:forward>
</c:otherwise>
</c:choose>
嵌套<if>之后相当于&&,但是在进入<when>后,如果没有进入<if>也同样不能进入<otherwise>,只会报错.
暂时这样有新进展再修改