<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>当用户登录成功时候 ,不再显示登录页面 ,换成欢迎登录

解决方案 »

  1.   

    我希望能像控制DIV的显示和隐藏那样的效果 而不用多做其他的页面
      

  2.   

    请诊断:${showDiv.userDto.userName}
    <c:if   test= "${null   !=   showDiv.userDto.userName} "> 
        欢迎登录 
    </c:if> 如上代码,观察登录后用户名是否正确存入到了Bean中。
      

  3.   

    那说明你可能没有赋值成功啊
    用6楼的在页面上看一下输出的是什么
    就知道为什么不执行<c:if   test= "${null   !=   showDiv.userDto.userName} "> 
                        欢迎登录 
                      </c:if>