John Hawkins wrote:
> >
> > You are working way too hard. If the second JSP page is on the same
> > server, you can just use <jsp:include> to include it, and the second
> > page will have access to the same session.
> >
>
> Not in this case, I need to use URL.OpenStream as I am saving the generated
> HTML to a file, not displaying it in the browser.
>
> Any ideas?
>
First, get your own session ID:
HttpSession session = request.getSession();
String sessionId = session.getId();
Next, modify the request URI you use to get the second JSP page, in the same
way that your servlet engine does it for usual requests when cookies are
disabled. The details of this are servlet engine specific, so check the
documentation on yours (or just turn cookies off and run a session-based app,
and observe the URLs you get back).
You can't count on being able to call HttpServletResponse.encodeURL() to do
this modification for you, because you might be using cookies to get to the
first page and encodeURL() would not do anything.
> John
Craig
===========================================================================
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