> If I dynamically create a file on the server (say in a
> servlet) in memory,
> how can I send it back to the client so they get a pop-up
> dialog that asks
> them to save it? Also, how can I make sure the filename in
This is the easy one.
public void SetContType(javax.servlet.http.HttpServletResponse
response, String filename) {
// Get and set the type of the file
String contentType =
getServletContext().getMimeType(filename);
response.setContentType(contentType == null ?
"application/octet-stream" : contentType );
}
if you like you can add check for additional content types. But for
download you can specify your content
type. For example:
"application/x-srdjan-pantic"
> the pop-up box
> (the default to save it under) is a name I specify?
This is the hard one.
In ASP, ColdFusion, any other CGI program, I would try something like in
URL:
/download/getFile.cfm?id=1/mod.cwg
And I will get mod.cwg as name for download in SAVE AS textbox.
But, when I try same in Java environment, using MVC architecture:
/eBiz/servlet/com.asucon.ebiz.download.web.GetFileServlet/mod.cwg
nothing, doesn't work.
If anybody have answer for this one, I will be grateful, too.
Kind regards,
Srdjan
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets