And you've verified that link.toString() actually is a a valid URL? What
happens when you put that in the browser? You get the null pointer
exception?

You not using cookies for session then right?
ie. you don't want to pass that stuff in as a cookie?


> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Kevin Duffey
> Sent: Thursday, April 19, 2001 10:18 PM
> To: [EMAIL PROTECTED]
> Subject: Catching exception JSP throws when reading it in for XML
> output..
>
>
> Hi all,
>
> I am having a bit of a problem trying to get the exception thrown in a JSP
> page that is being read in via code (instead of forwarded or
> redirected to).
> I am doing this to use JSP to spit out dynamic XML (instead of
> HTML). I know
> there are some taglibs that allow parts of a JSP page to be used in this
> fashion. I want to use the whole page. So I do this:
>
> try
> {
>   StringBuffer link = new StringBuffer();
>   link.append( request.getScheme() + "://localhost" + r.getName() );
>   if( r.getName().indexOf("?") >= 0 )
>     link.append("&jsessionid=" + request.getSession(true).getId() );
>   else
>     link.append("?jsessionid=" + request.getSession(true).getId() );
>
>   URL url = new URL(link.toString());
>
>   xmlStream = new StreamSource(url.openConnection().getInputStream());
> }
> catch(Exception e)
> {
>   System.out.println(e.getMessage());
>   e.printStackTrace(System.out);
> }
>
>
>
> If anyone has better code to read in JSP for its dynamic output, I am all
> ears (or eyes). The problem is, if you have a JSP page like this:
>
> <%
>   Object o = null;
>   System.out.println(o.toString());
> %>
>
> <my-tag>
> </my-tag>
>
>
> The JSP page will "break" at run-time, throwing a Null Pointer Exception.
> But, in the catch block, where it prints both the error message and the
> stack trace, you don't see the same error message you would see in the
> browser if you had just forwarded to that JSP page. The error should spit
> out some sort of Null Pointer Exception message. But the error I get, no
> matter what error the JSP page generates (both compile time and run time),
> is always a File Not Found exception..meaning it was not able to
> "open" the
> JSP page and read its contents in.
>
> So, how would I get the JSP error message it sends to the output (or catch
> it) to redisplay it?
>
> Thanks.
>
> ==================================================================
> =========
> 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