<%
//ProgramName: Download
// Program functions:
// Creation date: 08:49:52
// Created by: yanchao
// Update record: reason/content of the updated person's update date
//
%>
<% @ Page import = "Java. util. *" %>
<% @ Page import = "Java. Io. *" %>
<% @ Page import = "java.net. *" %>
<%
Response. setcontenttype ("application/X-download"); // set it to download application/X-Download
String filedownload = "/temp_lp/help/JSF. chm"; // relative path of the file to be downloaded
String filedisplay = "Help. chm"; // name of the file to be saved when the file is downloaded
String filenamedisplay = urlencoder. encode (filedisplay, "UTF-8 ");
Response. addheader ("content-disposition", "attachment; filename =" + filenamedisplay );
Try
{
Requestdispatcher Dis = application. getrequestdispatcher (filedownload );
If (DIS! = NULL)
{
Dis. Forward (request, response );
}
Response. flushbuffer ();
}
Catch (exception E)
{
E. printstacktrace ();
}
Finally
{
}
%>
<HTML>
<Script language = "JavaScript">
</SCRIPT>
</Html>