Jim King wrote:

> Hi everyone
> This is the third time I send this question with no answers.
> Please help...
>
> I have the following code:
>
> This is the main page
> // if login successfully
> session.invalidate();    // invalidate previous session
> session =3D request.getSession(true);    // create session
> session.setAttribute("loginName", loginName);    // put the login ID
> session.setMaxInactiveInterval(900);
> On the secondPage.jsp I have:
> <%
>   if (session.getValue("loginName")==null)
>   response.sendRedirect(response.encodeURL("error.html"));

Insert a "return;" statement here.  The call to "response.sendRedirect()" is a
method call, not a GO TO, so unless you tell the page otherwise it will continue to
render the remainder of the current JSP page.  The revised syntax would be:

<%
    if (session.getValue("loginName") == null) {
        response.sendRedirect(response.encodeURL("error.html"));
        return;
    }
%>

>
> %>
>

Craig McClanahan

===========================================================================
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