<jsp:useBean id="showDiv" class="form.UesrForm" scope="session"></jsp:useBean><c:if test="${null != showDiv.userDto.userName}">
欢迎登录
</c:if>
<c:if test="${null == showDiv.userDto.userName}">
<form action="<%=basePath %>LoginServlet">
用户名:<input type="text" name="username"><br>
密码:<input type="password" name="password"><br>
<input type="submit" value="提交">
</form>
</c:if>当用户登录成功时候 ,不再显示登录页面 ,换成欢迎登录
欢迎登录
</c:if>
<c:if test="${null == showDiv.userDto.userName}">
<form action="<%=basePath %>LoginServlet">
用户名:<input type="text" name="username"><br>
密码:<input type="password" name="password"><br>
<input type="submit" value="提交">
</form>
</c:if>当用户登录成功时候 ,不再显示登录页面 ,换成欢迎登录
<c:if test= "${null != showDiv.userDto.userName} ">
欢迎登录
</c:if> 如上代码,观察登录后用户名是否正确存入到了Bean中。
用6楼的在页面上看一下输出的是什么
就知道为什么不执行<c:if test= "${null != showDiv.userDto.userName} ">
欢迎登录
</c:if>