很令人奇怪的错误

很奇怪,在模板文件中

<!-- 用于显示搜索结果列表的页面模板 -->
<#include "/shares/globalVar.ftl" >

<#import "/${suit.packageName}/utils/navigator.ftl" as navigator >
<#import "/${suit.packageName}/utils/pageindex.ftl" as pageMacro >
<#import "/${suit.packageName}/utils/friendlink.ftl" as friendLink >
<#import "/${suit.packageName}/utils/utils.ftl" as utils >
<#import "/${suit.packageName}/utils/hostUtils.ftl" as hostUtils >
<#import "/${suit.packageName}/utils/solrSimple.ftl" as solrSimple >
<#import "/${suit.packageName}/utils/relinks.ftl" as relinks >
<#import "/${suit.packageName}/utils/cooljsmenu.ftl" as menu >
<#import "/${suit.packageName}/utils/footer.ftl" as footer >

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%
String queryString = (String)request.getParameter("q"); 
if( queryString == null )
	queryString= "";
String start = (String)request.getParameter("start");
if( start == null )
	start="0";
%>
<link href="${themePath}/css/ziye.css" type=text/css rel=stylesheet>
<title>信息检索-${host.title?html}</title>
<@utils.script4MM />
<@utils.windowOnLoadFunction />
<script type="text/javascript" >
/**
 * used for search result page init search input .
 */
function initRealQueryString(){
	$('#start').val("0");
	var query =  $('#queryString').val();
	if( query == "" )
	{
		return false;
	}
	var type = $('#solrTypeSelect').val();
	var rq = "";
	if( type != 'all' )
		rq = 'type:' + type + ' AND ';
	rq = rq + '(content:' + query + ' OR title:' + $('#queryString').val() + ') ';
	$('#realQueryString').val( rq );
	return true;
}

$(document).ready( function() {
		init();
		document.getElementById('queryString').onkeydown = function() {
			//alert('key down');
			if( event.keyCode == 13 ) {
			if( !initRealQueryString() )
				return false;
			}
			return true;
		};
		$('#realSubmitBtn').bind('click', function() {
			//alert('real submit button ');
			if( !initRealQueryString()) {
				alert('请输入查询字符串.');
				return false;
			}
			document.getElementById('searchForm').submit();
		});
	}
);

function init() {
	/*$('#solrTypeSelect').val('<%=request.getParameter("typeSelect")%>' );
	if($('#queryString').val() == "" )
	{
		// do nothing 
		//alert( 'q is empty ');
		return ;
	}*/
	/* else {
		$('#tempQueryString').val( $('#realQueryString').val() );
		//$('#realQueryString').val( 'content:' + $('#tempQueryString').val() );
		search();
	}*/
	search();
}

function search() {
	var form_data = $('#searchForm').serialize();
	// http://localhost:8080/solr/select
	//alert(form_data);
	 alert('http://localhost:8080/solr/select?' + form_data);
	$.getJSON('${solrSearchHref}', form_data, function(r) {
		//var rep = eval( '(' + r + ')' );
		alert( r );
		//var rep = eval( '(' + r + ')' );
		//alert( "number found : " + r.response.numFound) ;
		if( typeof( r.response.numFound ) == 'undefined' )
			$('#numFound').text('0');
		else 
			$('#numFound').text( r.response.numFound );
		var i = 0 ; 
		/*if( r.response.numFound == 0 ) {
			$('#resultNullDiv').css('display', 'block' );
			return;
		}*/
		$('#loadingDiv').css('display', 'none');
		$('#searchTotalCountDiv').css('display', 'block');
		for( i = 0 ; i < r.responseHeader.params.rows  ; i++ )
		{
			createDiv4Content( r.response.docs[i] );
		}
		//alert( "number found : " + r.numFound );
		createPageIndex( new Number(r.response.numFound), 
				new Number(r.responseHeader.params.start), 
				new Number(r.responseHeader.params.rows) );
	});
}
function createDiv4Content(doc){
	try{
		var resultDiv = $('#resultDiv');
		var resultp = $('#result');
		var h1 = $('<h1><a href="' + doc.url + '" target="_blank" >'+ doc.title+ '</a></h1>');
		var content = $('<p>' + new String(doc.content).substring(0,100) + '</p>');
		resultDiv.append(h1);
		resultDiv.append(content);
	}
	catch(ex) {
	}
}

function createPageIndex( numFound , start , rows){
	var div = $('.yema');
	//alert( numFound + ' ' + start + ' ' + rows );
	var i = 0 ;
	var page = new Number(( numFound / rows ))*1 + ((numFound % rows == 0 ) ? 0 : 1);
	//alert( "page: " + page );
	for( i = 1 ; i <= page ; i++ ){
		var pi = $('<a class="pi" href="search.jsp?start="'+ (i-1)*rows +' id="' + i + '" >' + i + '</a>' );
		div.append( pi );
	}
	$('.pi').bind( 'click' , function() {
		//$('#queryString').val( $('#tempQueryString').val() );
		$('#start').val( (this.id-1) * rows );
		document.getElementById('searchForm').submit();
		return false;
	}
	);
}

</script>
</head>

<body onload="windowLoadFunction();">
<DIV id=wrap>
<DIV id=header>
	<DIV id=logo></DIV>
	<DIV id=topnav><@utils.topLinks /></DIV>
	<DIV id=nav>
	<@menu.simpleChannelMenu />
	</DIV>
</DIV><!--head over-->

<DIV id=content>
<DIV id=main>
	<DIV id=crumb class="crumb">当前位置:<a href="index.html">首页</a>-><a href="search.html">搜索</a></DIV>
	<DIV id=rightbox>
		<h3><SPAN><SPAN><SPAN class="sizscolor">信息检索</SPAN></SPAN></SPAN></h3>
		<DIV class=searchtong>
			<form action="${httpPrefix}/${hostDirPath}/search.jsp" id="searchForm" method="get" id="fm-search">
			<input type=hidden name="indent" value="on" >
			<input type=hidden name="version" value="2.2" >
			<input type=hidden id="start" name="start" value="<%=start %>" >
			<input type=hidden name="rows" value="10" >
			<input type=hidden name="fl" value="*" >
			<input type=hidden name="qt" value="standard" >
			<input type=hidden name="wt" value="json" >
			<!-- <input type=hidden  id="realQueryString" name="q" value="<%=queryString %>"> -->
			  <label>
			  <input name="q" id="queryString" type="text" value="<%=queryString %>" class="textField"/>
			  <input name="realSubmitBtn" id="realSubmitBtn" type="submit" value="" class="searchBtn"/>
			  </label>
			</form>
		</DIV>
		<DIV class="result" id="resultDiv" >
			<div class="resultsm" style="display:none;padding-top: 20px;" >
			找不到和您的查询 "<strong><%=queryString %></strong>" 相符的网页。<br>
			建议:<br>
			<ul><li>请检查输入字词有无错误。</li>
			<li>请换用另外的查询字词。</li>
			<li>请改用较常见的字词。</li></ul> 
			</div>
			<DIV class="resultsm" id="searchTotalCountDiv" style="display:none;" >
				检索结果:共有<SPAN class="total" id="numFound" >8</SPAN>条记录满足条件。
			</DIV>
			<DIV id="loadingDiv" class="resultsm">
				正在搜索......
			</DIV>
		</DIV>
		<div class="yema" >
		<!--
			<p><SPAN>当前页:<SPAN class="current">1</SPAN>页/<SPAN class="total">1</SPAN>页</SPAN><SPAN>每页<SPAN>10</SPAN>条</SPAN><a href="#">首页</a><a href="#">上页</a><a href="#">下页</a><a href="#">尾页</a><SPAN>跳转至</SPAN>
			</p>
			<form id="form1" name="form1" method="post" action="" class="ym">
			<label>页</label><select name="menu1" onchange="MM_jumpMenu('parent',this,0)">
			  <option>1</option>
			  <option>2</option>
			  <option>3</option>
			  <option>4</option>
			  <option>5</option>
			</select>
			</form>
			-->
		</div>
	</DIV><!--rightbox over-->
	<DIV class=clear></DIV>
	<#-- footer here -->
	<@footer.footer /><!--foot over-->
</DIV><!--main over-->
</DIV><!--content over-->
</DIV><!--wrap over-->
</body>
</html>

  

body {
	margin:0;
	padding:0;
	font:normal 12px Tahoma, Arial, Helvetica, sans-serif;
	color:#666666;
	background:#989898;
}
#content { width:1002px; padding-top:6px }
#main { margin:0 auto; width:990px }
#rightbox { border:1px solid #8FC1F4; padding:4px 4px 30px; height:auto!important; height:476px; min-height:476px; }

.searchtong { height:34px; width:626px; margin:40px auto; background:url(../images/searchIcon.png) no-repeat 0 0; padding:5px 0 0 44px; }
.searchtong #searchForm { float:left; width:625px; margin-top:4px; }
.searchtong #searchForm input#queryString { width:550px; height:21px; line-height:16px; border-left:1px solid #DBEBF3; border:1px solid #7CAEE0; float:left; margin-left:5px; padding-top:2px; }

.result { width:800px; margin:10px auto;  text-align:left; } 
	.resultsm { color:#333; margin:10px 0 20px; }
	.resultsm span { margin:0 2px; }
	span.total { color:red; }
	span.key { color:red; }
 .result h1 { margin:10px 0; background:#EFEFEF; height:30px; line-height:30px; padding:0 10px; }
 .result p { text-indent:0; color:#333; margin:0 0 30px; }
.result a { text-decoration:underline; color:#16448E; }

 虽然在CSS设定了相关DIV居中,可是在IE6宽屏显示文件一直在屏幕左侧,该居中的DIV没有居中,但IE7和FF均正常。

找了很久,才发现偏偏是模板顶部一段“<!-- 用于显示搜索结果列表的页面模板 -->” 惹的祸,删掉它页面则正常。

我感到很奇怪,这个怎么解释呢?明明是注释文件,不被程序读的呀,为啥还会因它而出错? 哎,实在搞不明白。

你可能感兴趣的:(jsp,json,css,Solr,qt)