⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchcontent.jsp

📁 struts+hibernate BBS mysql数据库 功能基本齐全
💻 JSP
字号:
<%@ page language="java" import="java.util.List" pageEncoding="gbk"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ page import="com.elan.forum.model.Forummodule"%>
<%@ page import="com.elan.forum.model.Forumpiece"%>
<%@ page import="com.elan.forum.model.ForumTopic"%>
<%
Integer pieceId = null;
Integer moduleId = null;
Integer topicId = null;
Integer hotReal = null;
String pieceIdStr = (String)request.getParameter("pieceIdStr");
String moduleIdStr = (String)request.getParameter("moduleIdStr");
String topicIdStr = (String)request.getParameter("topicIdStr");
pieceId = pieceIdStr != null && !"".equals(pieceIdStr.trim()) ? Integer.valueOf(pieceIdStr) : -1;
moduleId = moduleIdStr != null && !"".equals(moduleIdStr.trim()) ? Integer.valueOf(moduleIdStr) : -1;
topicId = topicIdStr != null && !"".equals(topicIdStr.trim()) ? Integer.valueOf(topicIdStr) : -1;
pieceId = request.getAttribute("pieceId") != null ? (Integer)request.getAttribute("pieceId") : -1;
moduleId = request.getAttribute("moduleId") != null ? (Integer)request.getAttribute("moduleId") : -1;
topicId = request.getAttribute("topicId") != null ? (Integer)request.getAttribute("topicId") : -1;
hotReal = request.getAttribute("hotReal") != null ? (Integer)request.getAttribute("hotReal") : -1;
%>
<script language="javascript">
	var nowDate = new Date();
	function getYear(yearStart) {
		var strYear = "";
		for(var i = yearStart + 1; i <= nowDate.getYear() ; i++) {
			strYear += "<option value=\"" + i +"\">" + i + "年</option>";
		}
		return strYear;
	}
	function getMonth(monthStart) {
		var strMonth = "<option value=\"1\">请选择</option>";
		for(var i = monthStart; i <= 12; i++) {
			strMonth += "<option value=\"" + i + "\">" + i + "月</option>";
		}
		return strMonth;
	}
	function getDay(startDay) {
		var strDay = "<option value=\"1\">请选择</option>";
		for(var i = startDay; i <= 31; i++) {
			strDay += "<option value=\"" + i + "\">" + i + "日</option>";
		}
		return strDay;
	}
	// check search form
	function checkSearchForm() {
		//if(checkEmptyModule() && checkEmptyPiece() && checkEmptyTopicName() && checkEmptyTopicId()) {
		//	alert("sss");
		//}
	}
	
	function checkEmptyModule() {
		var objModule = getObject("module");
		if(-1 == objModule[0].value) {
			return true;
		}
		return false;
	}
	function checkEmptyPiece() {
		var objPiece = getObject("piece");
		if(-1 == objPiece) {
			return true;
		}
		return false;
	}
	function checkEmptyTopicName() {
		var objTopicName = getObject("topicName");
		alert(objTopicName.value);
		if("" == objTopicName.value) {
			alert(objTopicName.value);
			return true;
		}
		return false;
	}	
	function checkEmptyAuthor() {
		var objAuthor = getObject("author");
		if("" == objAuthor) {
			return true;
		}
		return false;
	}
	function checkEmptyTopicId() {
		var objTopicId = getObject("topicId");
		if("" == objTopicName.value) {
		
		}
	}
	function getObject(objId) {
		return document.getElementById(objId);
	}
	
	//隐藏搜索
	function displaySearchForm() {
		var objSearchForm = getObject("searchForm");
		var objSearchHead = getObject("searchHead");
		if(objSearchForm.style.display == 'none') {
			objSearchForm.style.display = "";
			objSearchHead.style.display = "none";
		} else {
			objSearchForm.style.display = "none";
			objSearchHead.style.display = "";
		}
		return true;
	}
</script>
<%
	List<Forummodule> listModule = (List<Forummodule>) request
			.getAttribute("listModule");
	List<Forumpiece> listPiece = (List<Forumpiece>) request
			.getAttribute("listPiece");
	List<ForumTopic> listTopic = (List<ForumTopic>) request
			.getAttribute("listTopic");
%>
<center>
	<font color="red"><html:errors />
	</font>
</center>
<form
	action="<%=request.getContextPath()%>/forum/topic.do?action=search"
	method="post">
	<input type="hidden" name="isSearch" value="true">
	<div id="searchHead" style="display: none">
		<table width="100%" border="0" cellspacing="2" cellpadding="0"
			class='forum_quote_content' style="BORDER: #91a9bd 2px solid;">
			<thead>
				<tr>
					<th bgcolor="#a1a9bd" width="50">
						<strong><font size="-1" id="fontText"><span
								onclick="displaySearchForm()" style="cursor: pointer">+显示</span>
						</font>
						</strong>
					</th>
					<th colspan="3" bgcolor="#a1a9bd">
						<strong><font size="-1">论坛搜索</font>
						</strong>
					</th>
				</tr>
			</thead>
		</table>
	</div>
	<div id="searchForm" style="display: ">
		<table width="100%" border="0" cellspacing="2" cellpadding="0"
			class='forum_quote_content' style="BORDER: #91a9bd 2px solid;">
			<thead>
				<tr>
					<th bgcolor="#a1a9bd" width="50">
						<strong><font size="-1" id="fontText"><span
								onclick="displaySearchForm()" style="cursor: pointer">-隐藏</span>
						</font>
						</strong>
					</th>
				</tr>
			</thead>
			<tr>
				<td height="25">
					板块类别:
					<select name="moduleId" id="module">
						<option value="-1">
							全部
						</option>
						<%
							for (int i = 0; listModule != null && i < listModule.size(); i++) {
								Forummodule fm = listModule.get(i);
						%>
						<option value="<%=fm.getId()%>"
							<%=(moduleId != null && moduleId.intValue() == fm
								.getId()) ? "selected" : ""%>><%=fm.getName()%></option>
						<%
							}
						%>
					</select>
				</td>
			</tr>
			<tr>
				<td height="25">
					文章类别:
					<select name="pieceId">
						<option value="-1">
							全部
						</option>
						<%
							for (int i = 0; listPiece != null && i < listPiece.size(); i++) {
								Forumpiece fp = listPiece.get(i);
						%>
						<option value="<%=fp.getId()%>"
							<%=(pieceId != null && pieceId.intValue() == fp
										.getId()) ? "selected" : ""%>><%=fp.getName()%></option>
						<%
							}
						%>
					</select>
				</td>
			</tr>
			<tr>
				<td height="25">
					热门程度:
					<select name="hotReal">
						<option value="-1">
							全部
						</option>
						<option value="1"
							<%=hotReal != null && hotReal == 1 ? "selected" : ""%>>
							热门
						</option>
						<option value="2"
							<%=hotReal != null && hotReal == 2 ? "selected" : ""%>>
							精华
						</option>
					</select>
				</td>
			</tr>
			<tr>
				<td height="25">
					帖子ID:
					<input type="text" name="topic">
					(如选了这项,则返回对应的一条记录)
				</td>
			</tr>
			<tr>
				<td height="30" align="left">
					帖子名:
					<input type="text" name="topicName">
					精确
					<input type="radio" name="precision" value="1" />
					模糊
					<input type="radio" name="precision" value="2" checked />
				</td>
			</tr>
			<tr>
				<td height="30" align="left">
					作者名:
					<input type="text" name="author">
					(正确的作者名)
				</td>
				<td height="30" align="left">
				</td>
			</tr>
			<tr>
				<td height="30" align="left">
					开始时间: 年份:
					<select name="startYear">
						<option value="2000">
							请选择
						</option>
						<script language="javascript">
							document.write(getYear(2000));
						</script>
					</select>
					月份:
					<select name="startMonth">
						<script language="javascript">
							document.write(getMonth(1));
						</script>
					</select>
					日期:
					<select name="startDay">
						<script language="javascript">
							document.write(getDay(1));
						</script>
					</select>
					(默认2000年1月1日开始)
				</td>
			</tr>
			<tr>
				<td height="30" align="left">
					结束时间: 年份:
					<select name="endYear">
						<option value="2010">
							请选择
						</option>
						<script language="javascript">
							document.write(getYear(2000));
						</script>
					</select>
					月份:
					<select name="endMonth">
						<script language="javascript">
							document.write(getMonth(1));
						</script>
					</select>
					日期:
					<select name="endDay">
						<script language="javascript">
							document.write(getDay(1));
						</script>
					</select>
					(默认2010年1月1日结束)
				</td>
			</tr>
			<tr>
				<td align="center">
					<input type="submit" value="搜索"
						onclick="javascript:checkSearchForm();">
				</td>
			</tr>
		</table>
	</div>
</form>
<hr>
<div class="bodywidth">
	<table width='100%' border='0' cellspacing='0' cellpadding='0'
		class='topic_list_tb'>
		<tr>
			<td align="center" colspan="5">
				<font color="red">[搜索结果]</font>
			</td>

		</tr>
		<tr>
			<td align="center" colspan="5">
				<font color="red">条数:<%=request.getAttribute("topicCount")%></font>
			</td>
		</tr>


		<tr class='topic_list_mt'>
			<td class='topic_list_mt_status'></td>
			<td class='topic_list_mt_title'>
				标题
			</td>
			<td class='topic_list_mt_author'>
				作者
			</td>
			<td class='topic_list_mt_reply'>
				回复/查看
			</td>
		</tr>
		<tr class='topic_list_commontitle'>
			<td colspan='5'>
				版块帖子列表
			</td>
		</tr>
		<%
			for (int i = 0; listTopic != null && i < listTopic.size(); i++) {
				ForumTopic fa = (ForumTopic) listTopic.get(i);
		%>
		<tr class='topic_list_tr'
			onmouseover="this.className='topic_list_over'"
			onmouseout="this.className='topic_list_tr'">
			<td class='topic_list_icon'>
				<img src="/ElanNet/forum/view/skin/default/folder_new.gif"
					alt="论坛帖子" border="0">
			</td>
			<td class='topic_list_title'>
				<a
					href='/ElanNet/forum/topic.do?action=showTopic&topicId=<%=fa.getId()%>'><%=fa.getTitle()%></a>
			<td class='topic_list_author'>
				<cite><a href='/User/ShowUser.asp?UserID=1'><%=fa.getAuthor()%></a>
				</cite><em><%=fa.getCreateTime()%></em>
			</td>
			<td class='topic_list_reply_hits'>
				<strong class='topic_list_reply'><%=fa.getReply()%></strong>/
				<strong class='topic_list_hits'><%=fa.getClick()%></strong>
			</td>
		</tr>
		<%
			}
		%>
	</table>
	<table width="100%" border="0" cellspacing="2" cellpadding="0">
		<tr>
			<td height="30" colspan="2" align="right">
			</td>
		</tr>
	</table>
</div>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -