亲,请登录
欢迎登录福佳jsp空间
登录
忘记密码?
快捷登录
QQ
微信
支付宝
注册
服务热线:13616026886
首页
域名注册
jsp空间
php空间
在线充值
公司简介
公司新闻
公司简介
联系我们
退款相关
技术文档
资源下载
网站备案
技术文档
欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进
搜索
位置:
首页
>
技术文档
>
JAVA
>
J2EE
>
Servlet/Jsp
> 查看文档
jsp用超级链接方式实现“目标另存为”功能
人气:2013
2007-11-17
jsp:
<%...@ page language="java" contenttype="text/html; charset=gb18030"
pageencoding="gb18030"%>
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb18030">
<title>insert title here</title>
</head>
<body>
<a href="/test/test.do">1322</a>
</body>
</html>
action:
package action;
import java.io.fileoutputstream;
import javax.servlet.http.httpservletrequest;
import javax.servlet.http.httpservletresponse;
import org.apache.struts.action.action;
import org.apache.struts.action.actionform;
import org.apache.struts.action.actionforward;
import org.apache.struts.action.actionmapping;
public class teaction extends action ...{
public actionforward execute(actionmapping mapping, actionform form,
httpservletrequest request, httpservletresponse response) throws exception ...{
// todo auto-generated method stub
stringbuilder sb = new stringbuilder();
sb.append("1");
response.addheader("content-disposition", "attachment; filename=test.txt");
response.setcontenttype("application/octet-stream");
response.setcharacterencoding("gb2312");
response.getwriter().write(sb.tostring());
response.flushbuffer();
return null;
}
}
https访问
7*24小时服务
专业一线支持
7天无理由退款
关于我们
公司介绍
最新动态
联系我们
产品与服务
域名注册
jsp空间
php空间
常见问题
空间操作手册
网站备案相关
退款相关问题
技术支持
技术 QQ :178966803
联系电话:13616026886
联系邮箱:fjjsp@vip.163.com
扫描关注微信公众号
福佳空间在线客服
20944024
178966803
1946551451
扫描关注微信公众号
13616026886
JAVA空间
PHP空间
域名注册