If I give a return after the redirect, the common.jsp doesn't display but
the rest of the page that is the page where it is included gets displayed.
The control doesn't go to the login.jsp as I want it to.
I am using JavaWebserver2.0.

Thanks
JS

-----Original Message-----
From: Joseph Ottinger [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 09, 2001 9:27 PM
To: [EMAIL PROTECTED]
Subject: Re: include problem


You're still executing the rest of the page, IIRC... add "return;" after the
sendRedirect().


>From: "Singh, Jasbinder" <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: include problem
>Date: Fri, 9 Feb 2001 15:58:54 -0800
>
>Hi All,
>
>I am developing an application that requires secured login where the page
>should not be reached without logging.
>I have a common jsp that has the following scriptlet.
>common.jsp
><%
>javax.servlet.http.HttpSession sess = request.getSession(false);
>
>if ( sess.isNew() )
>
>   {
>
>     System.out.println("Session new");
>
>    response.sendRedirect("/login.jsp");
>   }
>
>   else
>
>     System.out.println("Session not new");
>
>   if ( sess.getValue("user")==null )
>
>   {
>
>    System.out.println("userid is null");
>
>    response.sendRedirect("/login.jsp");
>   }
>%>
>
>I include this jsp in all my other JSP's. When I try to invoke a page
>directly by typing the url, I get the above println statements
>correctly("Session new" and "userid is null") but still the page is
>displayed. The page login.jsp is not displayed. But when I invoke the
>common.jsp directly, the control does go to the login.jsp page.
>
>Am I missing something ? Is this possible or I have to include a similar
>scriptlet in every jsp that I write.
>
>Thanks in advance
>JS
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to