Bernd WENDER wrote:
> Craig wrote:
>
> > Because you have mapped the context to "/htmlgeos", the
> > following statement should work instead:
> >
> > RequestDispatcher rd =
> > sc.getRequestDispatcher("/AdminClient.jsp");
>
> Yes, this was my first try. I just checked it again, but unfortunately it
> doesn't work. Seems to be a bug.
> What do you think? Somebody similar experiences?
>
That's interesting ... I use this technique all the time to forward from servlets
to JSP pages. Are you sure that this page is in the document root directory for
your application (and not in a subdirectory below the document root)?
>
> Another issue came to my mind today: Reading the API doc about
> HttpServletRequest: HttpSession getSession(boolean create):
>
> > Returns the current HttpSession associated with this request or, if
> necessary, creates a new
> > session for the request. Use true for create to create a new session, or
> false to return the current
> > HttpSession.
>
> I found out that the system took the same session although I set the create
> flag to true. Is this correct?
> As I understand the above paragraph it isn't. I found out that my session
> id was created using a cookie.
> Has it something to do with that?
>
Yes, this is correct. To parphrase what the spec says, you are asking the servlet
engine to this when you call getSession with the "true" argument:
* Determine if there is an existing, valid, session
* If there is, give that session back to me.
* If there is not, create a new session and give that back to me.
If you call it with a "false" argument, the only thing that changes is step 3 --
you get a null back if there is no active session.
NOTE: The generated code for the JSP page effectively calls getSession() with a
true argument, if you declare that this page participates in a session (<%@ page
.... session="true" %>).
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