the two CGI lines provide the effect you want simply because you ommited
to pass a content-type header. thus, by default, the browser will prompt
you to save a file.
to achieve the same effect with servlets (which probably set a default
content-type), you just need to set the content type of the request to
some funcky mime-type like 'x-save-to-disk/flonk-flonk-flonk'
jm.
"Amornkul, Woody" wrote:
>
> Hi,
> With CGI, I can redirect the browser to a new file by the following
> two lines:
>
> printf("HTTP/1.0 302 Found\n");
> printf("Location: <path/filename>\n");
>
> The save box will appear to allow me to save the file.
>
> Can this be done with Java Servlet?
> I tried the following codes but it displays the content to the
> broswer instead.
>
> res.setStatus(res.SC_MOVED_TEMPORARILY);
> res.setHeader("Location", site);
>
> Thank you in advance,
> Woody
>
> ===========================================================================
> 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
===========================================================================
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