Here is a sample code.

Dosomething.jsp
----------------

<%-- Import Login info from session --%>
<jsp:useBean id="userLogin" scope="session" type="Login" class="Login">
 <%-- If Login Info doesn't already exist in session, call login page --%>
 <jsp:forward page="login.jsp" />
</jsp:useBean>

First, try to get the bean from the session, if it doesnt exist then forward
the request to the page which creates the session bean

login.jsp
--------

<%-- create the login session --%>
<jsp:useBean id="userLogin" scope="session" type="Login" class="Login">
</jsp:useBean>

<% ... set/get the login properties ..%>




----- Original Message -----
From: Brian Burridge <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 28, 1999 5:08 AM
Subject: Session Expiring and Null Pointer


> I've noticed that when the session expires (I'm using a session bean),
> either because the time expired or I reset the server, that I always get
>
> a null pointer exception. I finally tracked it down, and was surprised
> to find, that even though at the top of each page I call a method to
> check for a live session, and reroute the user to a different page to
> give them a new session, that the original JSP page continues to run,
> producing a null pointer when it tries to access data from the session
> bean (which now no longer exists).
>
> Any ideas how I can get around this?
>
>
>
> --
> Brian N. Burridge
> Lead Internet Analyst
> Cox Target Media Corporate Web Sites
> Internet Technology Services
> (727) 399-3000 Ext 3515
> [EMAIL PROTECTED]
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to