主页面:
main.jsp:
  <body> 
 <jsp:include page="include.jsp" flush="true">
  </body>
被包含页面:
include.jsp:
 <body>
     <%
      String name=(String)session.getAttribute("name");
     %>
    <c:if test="${name==null}">
      <% 
        response.sendRedirect("index.jsp"); 
       %>
    </c:if>
    <c:if test="${name!=null}">
     <h2><font style="color:blue">this is the main.jsp!!!!<font></h2>
    </c:if>
  </body>
我想只有在登陆的时候才能进入main.jsp页面,main.jsp中包含了include.jsp.如果session值为空的话通过include中的语句就直接跳转到index.jsp登陆页面。
我如果登陆了,再输入main.jsp可以显示this is the main.jsp,但是如果不登陆的话直接输入它不会跳转到index.jsp.请各位帮忙看一下!!!谢谢