When the user successfully logs in u can put a value on sesion object.
for e,g session.putValue("UserId",id of user)
then on each page first check whether session.getValue("UserId") is
null and if null
redirect user to login page.




Ron Quartel <[EMAIL PROTECTED]>@java.sun.com> on 03/06/2001
05:09:17 PM

Please respond to A mailing list about Java Server Pages specification
      and reference <[EMAIL PROTECTED]>

Sent by:  A mailing list about Java Server Pages specification and
      reference <[EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:
Subject:  Session listener redirect


I have created the following session listener class which works but
now I
want to redirect the client to the start page of the application
(index.jsp)
if they are trying to enter the application from another page.

Easy peasy lemon squeezey in asp using global.asa but at a loss with
java.

Any help greatly appreciated.

Code shown below.

Ron Quartel.



import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class SessionListener implements HttpSessionListener{

    public SessionListener() {
    }

    public void sessionCreated(HttpSessionEvent hse) {
        System.out.println("Session started");
        //redirect to start page if not alread there i.e index.jsp.
    }

    public void sessionDestroyed(HttpSessionEvent hse) {}

}

===========================================================================

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