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

📄 browse.jsp

📁 《JSP通用模块及典型系统开发实例导航》源代码
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=GB2312"
	pageEncoding="GB2312"%>
<%@ page import="java.util.Collection,java.util.Iterator"%>
<%@ page import="com.wxpn.tutorial.servlet.BBSMsg"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title>BBS-浏览</title>
</head>

<body>
<center>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td width="75%" bgcolor="#0000FF" height="35" align=center><b><font
			color="#FFFFFF">浏览留言 </font></b></td>
	</tr>
</table>
<table border="1" width="100%" bordercolorlight="#C0C0C0"
	bordercolordark="#FFFFFF" cellspacing="0" cellpadding="0">
	<tr>
		<td width="10%" bgcolor="#FCFCFC">编号</td>
		<td width="60%" bgcolor="#FCFCFC">题目</td>
		<td width="15%" bgcolor="#FCFCFC">撰写日期</td>
		<td width="15%" bgcolor="#FCFCFC">撰写人</td>
	</tr>
	<%if (request.getAttribute("c") == null) {

			%>
	<tr>
		<td width="" 75%"" colspan=5 bgcolor="#FCFCFC" align=center>还没有任何留言。</td>
	</tr>
	<%} else {
				Collection c = (Collection) request.getAttribute("c");
				if (c == null) {

				%>
	<tr>
		<td width="" 75%"" colspan=5 bgcolor="#FCFCFC" align=center>还没有任何留言。</td>
	</tr>
	<%} else {
					int totalPageNum = ((Integer) (request
							.getAttribute("totalPageNum"))).intValue();
					int currentPage = 1;
					if (request.getParameter("page") != null) {
						currentPage = Integer.parseInt(request
								.getParameter("page"));
					}
					Iterator iterator = c.iterator();
					while (iterator.hasNext()) {
						BBSMsg msg = (BBSMsg) iterator.next();

						%>
	<tr>
		<td width="10%" bgcolor="#FCFCFC"><a
			href="ReadServlet?id=<%=msg.getMb_id()%>"><%=msg.getMb_id()%></a></td>
		<td width="60%" bgcolor="#FCFCFC"><%=msg.getMb_title()%></td>
		<td width="15%" bgcolor="#FCFCFC"><%=msg.getStrCompose_date()%></td>
		<td width="15%" bgcolor="#FCFCFC"><%=msg.getAuthor()%></td>
	</tr>
	<%}%>
	<tr>
		<td width="75%" colspan=5 align=right height="50" bgcolor="#EFEFEF"><%if (totalPageNum > 1) {%>
		<a href="BrowseServlet?page=1">首页</a>|<a
			href="BrowseServlet?page=<%=currentPage>1?currentPage-1:1 %>">上一页</a>|<a
			href="BrowseServlet?page=<%=currentPage<totalPageNum?currentPage+1:totalPageNum %>">下一页</a>|<a
			href="BrowseServlet?page=<%=totalPageNum%>">末页</a> <%}

				%>
	</tr>
	<%}
			}

			%>
	<tr>
		<td width="75%" colspan=5 align=center height="50" bgcolor="#EFEFEF">
		<%//如果用户已经登录,则允许撰写留言:
			if (session.getAttribute("userName") != null) {%> [<a
			href="compose.jsp">撰写留言</a>] <%} else {

			%>[<a href="login.jsp">登录</a>] <%}%>
	</tr>
</table>
</center>
</body>
</html>

⌨️ 快捷键说明

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