Mark Berry wrote:
> Ok, Simple problem: Loss of session if cookies are not on doing a
> POST FORM.
> (BTW, I am using JRUN w/Linux IBM JDK 118)
>
> I am sending a POST w/file to a servlet from JSP.
>
> Here is my simple code to do so:
>
> ... JSP....
> <H1>Sample upload form</H1>
> <FORM ACTION="/servlet/SessionServlet" ENCTYPE="multipart/form-data"
> method=post >
> <INPUT TYPE="file" NAME="fileUp">
> <INPUT TYPE="submit" VALUE="upload">
> </FORM>
> ... JSP ...
>
Simple answer as well ... you need to use URL rewriting in your form action (in the
JSP page) so that the underlying servlet container knows what to do:
<FORM ACTION="<%= response.encodeURL("/servlet/SessionServlet") %>"
ENCTYPE="multipart/form-data" method="post">
Encoding is needed on ALL hyperlinks that point into your application, if you want
to maintain sessions without cookies.
You will need to do something similar on your sendRedirect() call in the servlet
itself, except you must use sendRedirectURL() instead. See the Servlet API
specification, or the associated tutorials, for more information.
Craig McClanahan
===========================================================================
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