⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 downloadfileaction.java

📁 是关于struts+hibernate+spring开发宝典的源代码,希望对大家有帮助,
💻 JAVA
字号:
//Created by MyEclipse Struts// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.1.0/xslt/JavaClass.xslpackage cn.hxex.action.struts.action;import java.io.File;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionMapping;import org.apache.struts.actions.DownloadAction;/**  * MyEclipse Struts * Creation date: 06-21-2006 *  * XDoclet definition: * @struts.action validate="true" */public class DownloadFileAction extends DownloadAction {	protected StreamInfo getStreamInfo(ActionMapping mapping, ActionForm form,			HttpServletRequest request, HttpServletResponse response)			throws Exception {		HttpSession session = request.getSession();		String contentType = (String) session.getAttribute("contentType");		String fileName = (String) session.getAttribute("fileName");		// Set the content disposition		response.setHeader("Content-disposition", "attachment; filename="				+ fileName);		File file = new File( "c:\\" + fileName);		return new FileStreamInfo(contentType, file);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -