最近在做一个搜索引擎的东西,自己做了一个预览文档的界面:
因为是基于struts的,就只贴界面的代码吧。
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ page contentType="text/html;charset=GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String fileID =(String)request.getAttribute("fileID");
String title = (String)request.getAttribute("title");
String url = (String)request.getAttribute("url");
String downloadurl = url;
String describe = (String)request.getAttribute("describe");
String author = (String)request.getAttribute("author");
String kind =(String)request.getAttribute("kind");
url = url.substring(0,url.lastIndexOf("/"));
url = url + "/Dreamers/converResource/" + fileID + ".swf";
url = url.replace("resources/",""); //以上是从后台得到的预览的文件路径等信息
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%=url %>
<base href="<%=basePath%>">
<title>My JSP 'ShowDoc.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">
-->
<style type="text/css">
<!--
.STYLE1 {font-family: "宋体"}
-->
</style>
</head>
<body onunload="SeeYouLater()" onblur=window.focus()>
<form action="close.action?title=<%=title%>" method="post" name="form1">
<input type="hidden" name="time" >
</form>
<script language="JavaScript">
pageOpen = new Date();
function SeeYouLater() {
pageClose = new Date();
minutes = (pageClose.getMinutes() - pageOpen.getMinutes());
seconds = (pageClose.getSeconds() - pageOpen.getSeconds());
time = (seconds + (minutes * 60));
form1.time.value=time;
document.form1.submit();
}
</script>
<form >
<table width="1299" height="1141" border="1">
<tr>
<td height="129" colspan="2" bgcolor="#66ccff"> </td>
</tr>
<tr>
<td width="1006" height="133" rowspan="4" bgcolor="#ccffff"><embed
src="<%out.println(url);%>"
width= "1100"
height= "1000"
autostart="True" loop="True" align="middle"
style="z-index:-1;" id="flashplayer" pluginspage="http://www.macromedia.com/go/getflashplayer" //文档的预览
menu="true"
play="true" type="application/x-shockwave-flash" name="flashplayer"></embed></td>
<td width="277" bgcolor="#99ffff"><a href="download.action?downFileName=<%=downloadurl%>"><img src="pic198643.jpg" alt="下载文档" /></a></td>
</tr>
<tr>
<td height="98" bgcolor="#99ffff">标题:<%=title %></td>
</tr>
<tr>
<td height="138" bgcolor="#99ffff">作者:<%=author %></td>
</tr>
<tr>
<td height="138" bgcolor="#99ffff">描述:<%=describe %></td>
</tr>
</table>
<table align="center">
<tr>
<td></td>
</tr>
</table>
<br />
</center>
<br>
</form>
</body>
</html>
界面不是很美观,见谅,哈哈,希望会有用。