系统是b/s结构,小弟需要在客户端web页面中直接打开服务器端的word文档(不能出现下载对话框),请问在jsp中该如何实现。现在的情况是点击该链接后就出现的下载对话框。
下面是jsp代码:
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="../../common/taglibs.jsp"%>
<%@ page import="com.sany.system.CoursewareManage"%>
<html> <head>
<base href="<%=basePath%>">
<title>课件列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css/sany.css" type="text/css">
</head> <body bgcolor="#FFFFFF" text="#000000" background="images/bg01.gif"
leftmargin="0" topmargin="8">
<form name="courseForm" method="post" aciton="">
<table width="760" border="0" cellspacing="0" cellpadding="0"
align="center" class="border01" bgcolor="#FFFFFF">
<tr>
<td colspan="5">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td bgcolor="#CC0000">
</td>
</tr>
</table>
</td>
</tr> <tr>
<td align="center" colspan="5">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td bgcolor="#CCCCCC" colspan="5">
<img src="images/space.gif" width="1" height="10">
</td>
</tr>
<tr>
<td colspan="5" valign="top" bgcolor="#efefef">
<img src="images/t_01.gif" width="752" height="34">
</td>
</tr>
<tr><td><a href="123.doc">clickme</a></td></tr>
</table>
</td>
</tr>
<tr>
<td align="center" colspan="5">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td bgcolor="#CCCCCC" colspan="5">
<img src="images/space.gif" width="1" height="10">
</td>
</tr>
<%
%>
</table>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" colspan="5">
<img src="images/space.gif" width="1" height="2">
</td>
</tr>
</table>
</form>
</body>
</html>
下面是jsp代码:
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="../../common/taglibs.jsp"%>
<%@ page import="com.sany.system.CoursewareManage"%>
<html> <head>
<base href="<%=basePath%>">
<title>课件列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css/sany.css" type="text/css">
</head> <body bgcolor="#FFFFFF" text="#000000" background="images/bg01.gif"
leftmargin="0" topmargin="8">
<form name="courseForm" method="post" aciton="">
<table width="760" border="0" cellspacing="0" cellpadding="0"
align="center" class="border01" bgcolor="#FFFFFF">
<tr>
<td colspan="5">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td bgcolor="#CC0000">
</td>
</tr>
</table>
</td>
</tr> <tr>
<td align="center" colspan="5">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td bgcolor="#CCCCCC" colspan="5">
<img src="images/space.gif" width="1" height="10">
</td>
</tr>
<tr>
<td colspan="5" valign="top" bgcolor="#efefef">
<img src="images/t_01.gif" width="752" height="34">
</td>
</tr>
<tr><td><a href="123.doc">clickme</a></td></tr>
</table>
</td>
</tr>
<tr>
<td align="center" colspan="5">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td bgcolor="#CCCCCC" colspan="5">
<img src="images/space.gif" width="1" height="10">
</td>
</tr>
<%
%>
</table>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" colspan="5">
<img src="images/space.gif" width="1" height="2">
</td>
</tr>
</table>
</form>
</body>
</html>
解决方案 »
- 调用webservice是没有错 自动生成客户端时报错
- checkBox翻页时候总是默认全部选中
- form提交时action属性指向的页面无响应!
- 同一个应用在jboss下发布2份,启动第二个web的时候提示DuplicateMappingException?
- JavaBean的使用
- win2000+TOMCAT5的JSP的html页面代码只输出了部分请问该如何解决?急!
- 我想在JSP中分栏显示,我想点击按钮时在下面的栏中显示查询结果,我该怎么做?
- 关于equlas的问题
- 关于海量数据插入oracle CLOB 字段的解决方法(不够分再加)
- 定时刷新
- 给点提示就送分!!
- 编码问题,搞了一下午了!!!!!!!!!!!!!!!!!!!!!!帮忙啊
response.addHeader("Content-Disposition", "attachment; filename="+fileName);
fileName下载的文件名
但是下载对话框的下面不是有一个
“打开此类文件总是询问”的checkbox吗?
把前面的勾去掉
下次就直接打开word文件了
属于不是办法的办法~~~~
直接用<a>都能直接打开的...
path="\upload\word\word.doc";
<a href="<%=path%>" >WORD</a>