> David Galimberti wrote:
> [ . . . ] I am using the servlet as a source to an
> image as follows:
>
> <img src="\servlet\myServlet">
>
> If I forward/redirect to my servlet from the JSP I have access to the
> session variables but if I use the servlet as a source to the image I
> do not (it actually wants to create a new session, i.e.
> request.getSession(false) returns null).

First of all, you need to use correct URL slashes (/).  Second, it's a
good idea to use response.encodeUrl(...) for *every* link on your page
that needs to maintain session.  This would include embedded <IMG...>
tags that draw their data from servlets:

<img src="<%= response.encodeUrl("/servlet/myServlet") %>">

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

Reply via email to