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