社区
Web 开发
帖子详情
web 项目中的 dd 如何用excel打开?
wfg114
2010-01-07 03:53:41
在web 项目中,jsp 文件中用 <a href="c:\a.xls">dd</a> ,关联了一个 excel 文件,
当点击时,会弹出 打开 保存 的对话框 , 保存没有问题, 可是打开时总是在 ie 中打开,
我想点打开时,用 Excel 打开,
怎么设置或是怎么做呀?
...全文
293
9
打赏
收藏
web 项目中的 dd 如何用excel打开?
在web 项目中,jsp 文件中用 dd ,关联了一个 excel 文件, 当点击时,会弹出 打开 保存 的对话框 , 保存没有问题, 可是打开时总是在 ie 中打开, 我想点打开时,用 Excel 打开, 怎么设置或是怎么做呀?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
luchuguo
2010-01-07
打赏
举报
回复
openType.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'openType.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<% String str1=request.getParameter("submit1");
String str2=request.getParameter("submit2");
if(str1==null)
{
str1="";
}
if(str2==null)
{
str2="";
}
if(str1.startsWith("word"))
{
response.setContentType("application/msword");
}
if(str2.startsWith("excel"))
{
response.setContentType("application/x-msexcel");
}
%>
<jsp:include page="A.txt" />
</body>
</html>
setMine.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>MIME类型</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<p>你想使用什么方式查看文本文件A.txt?</p>
<form action="openType.jsp" method="post" name=form>
<input type="submit" name="submit1" value="word">
<input type="submit" name="submit2" value="excel">
</form>
</body>
</html>
wfg114
2010-01-07
打赏
举报
回复
sun914 :
您好!我没太明白你的意思,可以详细解说一下吗?
bayougeng
2010-01-07
打赏
举报
回复
在服务器端做不到。客户端没准可以设置的。
ABAP1314
2010-01-07
打赏
举报
回复
用的是JSP 那Jsp 本身 表头标签 有EXCEL 的标签
具体标签忘了没记
你找下把
操作也是正常 把数据传给JSP 在JSP 你写入那个表头标签 然后数据有拼表格就行 获取数据
maer56
2010-01-07
打赏
举报
回复
你是不是把windows的xls类型文件和IE关联了?
wfg114
2010-01-07
打赏
举报
回复
zhoupuyue 老兄的在web.xml 中的设置,我也试过了,
也不行,
我用的ie7
wfg114
2010-01-07
打赏
举报
回复
试试 <a href="c:\a.xls" target="_blank">dd </a>
这种方法,它会重新打开一个新的 ie 窗口,但 xls 文件还是在ie中打开的,
行不通,
谢谢!
阿_布
2010-01-07
打赏
举报
回复
试一下下面的方法看行不行,没测试:
<a href=".../test1.doc">open the word</a>
<a href=".../test2.xls">open the excel</a>
在web.xml里面加上下面两句:
<mime-mapping>
<extension>doc</extension>
<mime-type>application/vnd.ms-word</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xls</extension>
<mime-type>application/vnd.ms-excel</mime-type>
</mime-mapping>
maer56
2010-01-07
打赏
举报
回复
试试<a href="c:\a.xls"
target="_blank"
>dd </a>
汽车雷达多干扰下信号幅相精准估计:全卷积网络新方案【附python代码】.rar
1.版本:matlab2014a/2019b/2024b 2.附赠案例数据可直接运行。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
HTML浪漫动态表白代码
代码转载自:https://pan.quark.cn/s/a4b39357ea24 考虑到仓库大小,此程序单独存放,请前往 https://.com/sun0225SUN/C-Love-Code
山西忻州代县产业发展分析建议:数字化赋能,科技创新驱动未来.docx
山西忻州代县产业发展分析建议:数字化赋能,科技创新驱动未来
C# OnnxRuntime 部署 APISR 动漫超分辨率模型.rar
C# OnnxRuntime 部署 APISR 动漫超分辨率模型 博客地址:https://blog.csdn.net/lw112190/article/details/159728652
Windows server实现高可用
Windows server实现高可用
Web 开发
81,114
社区成员
341,728
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章