最近在做一个在线文档阅读系统,用swftools将pdf转换成swf后,将swf的绝对地址传到一个jsp页面,但在浏览器中就是加载不出来这个swf文件。。如果用html页面来加载这个swf文件的话能显示出来。好了,不多说了上显示页面代码:
<%@ page language="java" pageEncoding="utf-8"%>
<%
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>阅读文档</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 swfPath = (String)application.getAttribute("swfPath");
out.println(swfPath);
%>
<div align = "center">
<embed src="<%=swfPath%>" quality="high" wmode="transparent" bgcolor="#ffffff" width="1200" height="1000" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </div>
</body>
</html>另外用IE打开上面这个无法显示SWF得JSP页面,查看源代码,src的路径也是对的。。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="http://127.0.0.1:8080/MywebStudy/">
<title>阅读文档</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>
D:\attachment\swf\Start_实习报告.swf
<div align = "center">
<embed src="D:\attachment\swf\Start_实习报告.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="1200" height="1000" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</div>
</body>
</html>
<%@ page language="java" pageEncoding="utf-8"%>
<%
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>阅读文档</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 swfPath = (String)application.getAttribute("swfPath");
out.println(swfPath);
%>
<div align = "center">
<embed src="<%=swfPath%>" quality="high" wmode="transparent" bgcolor="#ffffff" width="1200" height="1000" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </div>
</body>
</html>另外用IE打开上面这个无法显示SWF得JSP页面,查看源代码,src的路径也是对的。。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="http://127.0.0.1:8080/MywebStudy/">
<title>阅读文档</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>
D:\attachment\swf\Start_实习报告.swf
<div align = "center">
<embed src="D:\attachment\swf\Start_实习报告.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="1200" height="1000" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</div>
</body>
</html>
解决方案 »
- [求助]Hibernate更新问题
- strust2.0 token标签 首次就报错!
- 小弟雪天跪求高手解答!一个判断全角的问题
- spring 的baseaction有疑问,请高手解疑!!!
- 如何去取xml的部分格式(希望懂xml得都来看看)
- Hibernate的更新错误
- HELP !!!help!!!manito!!有谁遇见过??怎么解决???
- MyEclipse开发Struts+Hibernate 的菜鸟级问题
- 请教J2SDK,Apache2,resin2配置环境连接sql2000问题?
- 删除 console configuration文件
- 怎么调用jquery写的验证方法
- jboss+mysql+linux问题
<%
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 'index.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>
<body>
<%
//String swfPath = (String) application.getAttribute("swfPath");
//out.println(swfPath);
%>
<div align="center">
<embed src="source/test1.swf" quality="high" wmode="transparent"
bgcolor="#ffffff" width="1200" height="1000" align="middle"
allowScriptAccess="sameDomain" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</div>
</body>
</html>我这边可以啊,把你的swf文件放到WebRoot下。用相对路径试试。