<%@ page language="java" import="java.util.*" 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>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">
-->
<script type="text/javascript">
function Northwest()
{
var doc=document.getElementById("image").style;
//alert(doc.styleFloat);
doc.styleFloat="left";
doc.display="block";
var doc2=document.getElementById("image2").style;
doc2.display="none";
//doc2.styleFloat="left";
}
function Northeast()
{
var doc=document.getElementById("image").style;
doc.display="block";
doc.styleFloat="right";
var doc2=document.getElementById("image2").style;
doc2.display="none";
//doc2.styleFloat="left";
}
function Southwest()
{
var doc=document.getElementById("image").style;
doc.display="none";
var doc2=document.getElementById("image2").style;
doc2.display="block";
doc2.styleFloat="left";
}
function Southeast()
{
var doc=document.getElementById("image").style;
doc.display="none";
var doc2=document.getElementById("image2").style;
doc2.display="block";
doc2.styleFloat="right";
}
function Hidden()
{
var doc=document.getElementById("image").style;
if(doc.visibility!="hidden")
doc.visibility ="hidden";
else
doc.visibility="visible";
}
</script>
<style type="text/css">
#div{
text-align: center;
}
#p{
clear:none;
width:320;
}
#image{
float:right;
}
#image2{
float:left;
display:none;
}
</style>
</head>
<body>
<div id="div">
<p id="p">
<img alt="图片" src="1.gif" id="image">
通常比较厚的书籍后面常常附关键词索引表(比如:北京:12, 34页,上海:3,77页……),它能够帮助读者比较快地找到相关内容的页码。而数据库索引能够大大提高查询的速度原理也是一样,想像一下通过书后面的索引查找的速度要比一页一页地翻内容高多少倍……而索引之所以效率高,另外一个原因是它是排好序的。对于检索系统来说核心是一个排序问题。
由于数据库索引不是为全文索引设计的,因此,使用like "%keyword%"时
,数据库索引是不起作用的,在使用like查询时,搜索过程又变成类似于一页页翻书的遍历过程了,所以对于含有模糊查询的数据库服务来说,LIKE对性能的危害是极大的。如果是需要对多个关键词进行模糊匹配:like"%keyword1%" and like "%keyword2%" ...其效率也就可想而知了。
所以建立一个高效检索系统的关键是建立一个类似于科技索引一样的反向索引机制,将数据源(比如多篇文章)排序顺序存储的同时,有另外一个排好序的关键词列表,用于存储关键词==>文章映射关系,利用这样的映射关系索引:[关键词==>出现关键词的文章编号,出现次数(甚至包括位置:起始偏移量,结束偏移量),出现频率],
<img alt="图片" src="1.gif" id="image2">检索过程就是把模糊查询变成多个可以利用索引的精确查询的逻辑组合的过程。
从而大大提高了多关键词查询的效率,所以,全文检索问题归结到最后是一个排序问题。
</p>
<input type="button" name="Northwest" value="Northwest" οnclick="Northwest()"/>
<input type="button" name="Northeast" value="Northeast" οnclick="Northeast()"/>
<input type="button" name="Southwest" value="Southwest" οnclick="Southwest()"/>
<input type="button" name="Southeast" value="Southeast" οnclick="Southeast()"/>
<input type="button" name="Hidden" value="Hidden" οnclick="Hidden()"/>
</div>
</body>
</html>
WEB程序设计-JSP结合CSS控制图片出现的位置
最新推荐文章于 2021-02-16 15:57:58 发布