Nope, we just tried SKIP_PAGE and it worked.  ARGH!
--Angus

[EMAIL PROTECTED] wrote:
>
> try puttin return SKIP_BODY in finally block
> -----Original Message-----
> From: Angus Mezick [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 21, 2000 2:16 PM
> To: Shah Kartik
> Cc: [EMAIL PROTECTED]
> Subject: Re: [JSP-INTEREST] Taglibs: pageContext.sendRedirect()
>
> Not really a stack trace, but here is what I have seen through println's
> and a debugger:
> The code is run
> theData is set to null
> we go into the if and run the redirect.
> then we go back and run the rest of the page which includes a
> theData.someMethod(); call which spawns the NullPointerException.
> Very odd.
>
> Do I just need to call return SKIP_PAGE after the redirect?
> --Angus
>
> Shah Kartik wrote:
> >
> > Can you give printStackTrace for the same to figure out what exactly the
> > run
> > time example is telling
> >
> > -----Original Message-----
> > From: Angus Mezick [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 21, 2000 9:15 AM
> > To: [EMAIL PROTECTED]
> > Subject: Taglibs: pageContext.sendRedirect()
> >
> > This code doesn't seem to let the redirect work correctly.  The
> appropriate
> > getters and setters are in the file, just not included here for brevity's
> > sake.  Can someone please tell my why this tag doesn't forward me to
> 'path'
> > if 'theData' is null?  I end up with a NullPointerException when this
> page
> > is run.
> >
> > public class LoginOrForward extends TagSupport
> > {
> >    private HttpSession session=null;
> >         private String name;
> >         private String type;
> >         private String path;
> >
> >    public int doStartTag()
> >      throws JspTagException
> >       {
> >            session=pageContext.getSession();
> >            Object theData = session.getValue(name);
> >            if(theData == null)
> >            {
> >               try
> >               {
> >                  pageContext.sendRedirect(path);
> >               }
> >               catch(Exception e)
> >               {
> >                  e.printStackTrace();
> >               }
> >               return SKIP_BODY;
> >            }
> >            pageContext.setAttribute(name,theData);
> >            return SKIP_BODY;
> >       }
> >
> >    public int doEndTag() throws JspTagException
> >       {
> >         /* We skipped the body, don't do a thing */
> >          return EVAL_PAGE;
> >       }
> >
> > }
> >
> >
> ===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > 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".
> > 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".
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