Peter,
You can either use the errorPage attribute in the page directive or use put
the code in a try block and forward or redirect to the other page in the
catch block.

-Richard


At 01:36 PM 9/21/01 -0500, you wrote:

>I have a dilemma. The application I'm working on depends on a poller
>mechanism being active on the
>client browser. This works fine, even the timeout on the server for
>detecting if the poller stops.
>The problem arises when the client hits the Browser Stop button. The
>server correctly detects this
>condition and invalidates the session. However, since the page is still
>visible in the client browser,
>the user can press a button which posts a form to the server. The action
>form, message.jsp,
>initializes a bean and tries to access some data. But since the session is
>gone, Null Pointer
>pop up.
>
>To summarize my question, is there a way to catch the null pointer
>exception in the JSP page
>and then redirect to another JSP page which correctly can re-initialize
>the session?
>
>My action page looks like this.
>
><%@ page import="com.upfront.htmlc.*"%>
><%@ page import="com.upfront.htmlc.gui.*"%>
><jsp:useBean id="htmlcSession" scope="session"
>class="com.upfront.htmlc.HtmlcSession"/>
><%
>     StatusPage thisPage =
> htmlcSession.guiEngine.pageManager.statusPage;     <--------- NullPointer
> exception
>     if( htmlcSession.custMessagingEngine != null )
> htmlcSession.custMessagingEngine.processMessagePost( request );
>%>
><html>
><head>
>     <script>
>         <%=thisPage.getPageDomainScript()%>
>     </script>
></head>
><body bgcolor="<%=thisPage.getBackgroundColor()%>" topmargin=0
>bottommargin=0 leftmargin=2 rightmargin=0 onDragDrop="return false;">
>
><center><%=thisPage.statusMessage.toHTML()%></center>
></body>
></html>
>
>I indicated where the NullPointer occurr.
>
>/Peter

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