利用jspsmart,怎么写sevelet以下载服务器上的文件?
我想利用jspsmart组件,写一个sevelet,以实现对文件的下载?请大家帮忙
------解决方案--------------------jspSmartUpload的例子:
<%@ page language= "java " import= "com.jspsmart.upload.* "%> <jsp:useBean id= "mySmartUpload " scope= "page " class= "com.jspsmart.upload.SmartUpload " /> <%
// Initialization
mySmartUpload.initialize(pageContext);
// Download file
mySmartUpload.downloadFile( "/upload/sample.zip ");
// With a physical path
// mySmartUpload.downloadFile( "c:\\temp\\sample.zip ")
// With options
// mySmartUpload.downloadFile( "/upload/sample.zip ", "application/x-zip-compressed ", "downloaded.zip ")
%>
------解决方案-------------------- <jsp:useBean id= "mySmartUpload " scope= "page " class= "com.jspsmart.upload.SmartUpload " /> <%
mySmartUpload.initialize(pageContext);
// 设定contentDisposition为null以禁止浏览器自动打开文件,
//保证点击链接后是下载文件。若不设定,则下载的文件扩展名为txt时,直接在浏览器打开。
//文件类型为doc时,浏览器将自动用word打开它。扩展名为pdf时浏览器将用acrobat打开。
mySmartUpload.setContentDisposition(null);
// 下载文件
mySmartUpload.downloadFile( "/upload/test.txt ");%>
servlet就不知道了