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

📄 index.jsp

📁 一个bug管理系统
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java"
	import="java.sql.*" errorPage=""%>
<%!public String getStr(String s) {
		String str = s;
		try {
			byte b[] = str.getBytes("ISO-8859-1");
			str = new String(b);
			return str;
		} catch (Exception e) {
			return null;
		}
	}%>
<%
	String host = "localhost";
	String user = "root";
	String pw = "123";
	String db = "numb1";
	String showmas = "n";//showmas="y"时可在首页中填写留言,showmas="n"不可在首页中填写留言
	String pass = null;
	pass = (String) session.getAttribute("pass");

	int i = 0, x = 0;//计数器
	int showrow = 8;//每页显示条数
	int pages = 0;//当前页数
	int start; //本页开始条数

	Class.forName("com.mysql.jdbc.Driver").newInstance();
	String url = "jdbc:mysql://" + host + "/" + db
			+ "?allowMultiQueries=true";
	Connection con = DriverManager.getConnection(url, user, pw);
	Statement st = con.createStatement();
	String sql = "select id,title,name,tim,isre from lyb order by id desc";
	ResultSet numb1 = st.executeQuery(sql);
	String strp = (String) request.getParameter("pages");

	int sig = 1, alt;
	if (strp == null) {
		sig = 1;
	} else {
		for (int i1 = 0; i1 < strp.length(); i1++) {
			alt = strp.charAt(i1);
			if (alt < 48 || alt > 57) {
		sig = 1;
		break;
			} else {
		sig = 2;
			}
		}
	}
	if (sig == 1) {
		pages = 1;
	} else {
		pages = Integer.parseInt(strp);
	}

	numb1.last();
	int count = numb1.getRow();
	int laspc;
	int pa = count / showrow;
	if (count % showrow > 0) {
		pa = pa + 1;
		laspc = count % showrow;
	} else {
		laspc = showrow;
	}
	if (pages < 0)
		pages = 1;
	if (pages > pa)
		pages = pa;
	start = (pages - 1) * showrow + 1;
%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
		<title>提交Bug</title>
		<style type="text/css">
<!--
body {
	background-image: url(img/bg.gif);
	margin-top: 0px;
	margin-bottom: 5px;
}
.style1 {color: #FF0000}
.style2 {color: #FFFFFF}

td{font-size:14px}
th{font-size:16px}
a:link{text-decoration:none;color:#0000ff}
a:visited{text-decoration:none;color:#0000ff}
a:hover{text-decoration:underline;color:#ff0000}
.l {font-size:13px}
.l a:link{text-decoration:none;color:#0000ff}
.l a:visited{text-decoration:none;color:#0000ff}
.l a:hover{text-decoration:none;color:#ff0000}
-->
</style>
		<script language="JavaScript" type="text/JavaScript">
function check_form(theform)
	{
		if (theform.text.value=="")
		{
			alert("请写下bug的内通!");
			theform.text.focus();
			return false;
		}
		if (theform.title.value=="")
		{
			alert("请留下您bug的主题!");
			theform.title.focus();
			return false;
		}
		if (theform.name.value=="")
		{
			alert("请输入您的名字!");
			theform.name.focus();
			return false;
		}
		}

function checkall(check) {
	var i = <%=start%>;
	var theObj;

	for(; i<=<%=(showrow + start)%>; i++)
	{
		theObj = eval("form1.del" + i);

		if (theObj != null)
			theObj.checked = check;
	}
}
		function allcheck() {
	if (document.form1.a.checked == true)
		checkall(true);
	else
		checkall(false);
}

</script>
	</head>

	<body>
		<form name="form1" method="post" action="dell.jsp"
			onSubmit="return check()">
			<table width="780" border="0" align="center" cellspacing="0"
				bgcolor="#f8fff7">
				<tr>
					<td height="2"></td>
				</tr>
				<tr>
					<td>
						<img src="img/title.jpg" width="778" height="80">
					</td>
				</tr>
				<tr>
					<td>
						<hr>
					</td>
				</tr>
				<tr>
					<td class="l">
						&nbsp; 首页&gt;
						<span class="style1">您的bug</span>
					</td>
				</tr>
				<tr>
					<td height="10"></td>
				</tr>
				<tr>
					<td>
						<table width="100%" border="0" cellspacing="1" bgcolor="#c1d1c1">
							<tr>
								<td bgcolor="#f8f8f8">
									<table width="100%" border="0" cellspacing="0">
										<tr>
											<td width="43%" class="l">
												&nbsp;&nbsp;第
												<%=pages%>
												页 共
												<%=pa%>
												页&nbsp;&nbsp;
												<%
												if (pages > 1) {
												%>
												<a href="index.jsp">首页</a>
												<a href="index.jsp?pages=<%=pages - 1%>">上页</a>
												<%
													}
													if (pages < pa) {
												%>
												<a href="index.jsp?pages=<%=pages + 1%>">下页</a>
												<a href="index.jsp?pages=<%=pa%>">尾页</a>
												<%
												}
												%>
											</td>
											<td width="57%" class="l">
												<div align="right">
													<%
													if ("y".equals(pass)) {
													%>
													<input name="imageField" type="image" src="img/del1.jpg"
														width="76" height="21" border="0"
														onMouseOut="this.src='img/del1.jpg'"
														onMouseOver="this.src='img/del2.jpg'">
													<input name="showrow" type="hidden" id="showrow"
														value="<%=showrow%>">
													<input name="pages" type="hidden" id="pages"
														value="<%=pages%>">
													<%
															} else {
															if (showmas.equals("n")) {
													%>
													<a href="send.jsp"><img src="img/send1.jpg" width="77"
															height="21" border="0"
															onMouseOut="this.src='img/send1.jpg'"
															onMouseOver="this.src='img/send2.jpg'"> </a>
													<%
													}
													%>
													<a href="login.jsp"><img src="img/admin1.jpg"
															width="77" height="21" border="0"
															onMouseOut="this.src='img/admin1.jpg'"
															onMouseOver="this.src='img/admin2.jpg'"> </a>
													<%
													}
													%>
													&nbsp;
												</div>
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td height="10"></td>
				</tr>
			</table>
			<table width="780" border="0" align="center" bgcolor="#EFF0E2"
				style="BORDER-BOTTOM: #4F7B0D 1px solid; BORDER-LEFT: #4F7B0D 1px solid; BORDER-RIGHT: #4F7B0D 1px solid; BORDER-TOP: #4F7B0D 1px solid">
				<tr bgcolor="#4F7B0D">
					<th width="53" height="20">
						<span class="style2"> <%
 		if ("y".equals(pass)) {
 		out
 		.print("<input type=\"checkbox\" id=\"a\" onclick=\"return allcheck()\">");
 	} else {
 		out.print("编号");
 	}
 %> </span>
					</th>
					<th width="336" bgcolor="#4F7B0D">
						<span class="style2">主题</span>
					</th>
					<th width="83">
						<span class="style2">提交者</span>
					</th>
					<th width="217">
						<span class="style2">提交时间</span>
					</th>
					<th width="69">
						<span class="style2">处理</span>
					</th>
				</tr>
				<%
					numb1.absolute(start);
					numb1.previous();
					while (numb1.next()) {
				%>
				<tr bgcolor="#F8FFF7">
					<td>
						<div align="center">
							<%
										if ("y".equals(pass)) {
										out.print("<input name=\"del" + numb1.getRow()
										+ "\" type=\"checkbox\" value=\""
										+ numb1.getString(1) + "\">");
									} else {
										out.print(numb1.getRow());
									}
							%>
						</div>
					</td>
					<td>
						<div align="center">
							<a href="show.jsp?id=<%=getStr(numb1.getString(1))%>"
								target="_blank"><%=getStr(numb1.getString(2))%> </a>
						</div>
					</td>
					<td>
						<div align="center">
							<%=getStr(numb1.getString(3))%>
						</div>
					</td>
					<td>
						<div align="center">
							<%
									String tim = getStr(numb1.getString(4));
									out.print(tim.substring(5, 16));
							%>
						</div>
					</td>
					<td>
						<div align="center" class="style1">
							<%
										if (numb1.getString(5).equals("y")) {
										out.print("已处理");
									}
							%>
						</div>
					</td>
				</tr>
				<%
						i++;
						if (i == showrow)
							break;
					}
				%>
			</table>
			<%
				numb1.close();
				st.close();
				con.close();
			%>

			<table width="780" border="0" align="center" cellspacing="0">
				<tr>
					<td height="10"></td>
				</tr>
				<tr>
					<td>
						<table width="100%" border="0" align="center" cellspacing="1"
							bgcolor="#c1d1c1">
							<tr>
								<td bgcolor="#f8fff7" class="l">
									<div align="right">
										<%
												if (pa <= 5) {
												for (int j = 1; j < pa + 1; j++) {
													if (j == pages) {
										%>
										<font color=#ff0000>第<%=pages%>页</font>&nbsp;
										<%
										} else {
										%>
										<a href="index.jsp?pages=<%=j%>">第<%=j%>页</a>&nbsp;
										<%
												}
												}
											} else if (pages < 4) {
												for (int k = 1; k < pages + 3; k++) {
													if (k == pages) {
										%>
										<font color=#ff0000>第<%=k%>页</font>&nbsp;
										<%
										} else {
										%>
										<a href="index.jsp?pages=<%=k%>">第<%=k%>页</a>&nbsp;
										<%
												}
												}
											} else if ((pa - pages) < 4) {
												for (int l = pa - 5; l <= pa; l++) {
													if (l == pages) {
										%>
										<font color="#FF0000">第<%=l%>页</font>&nbsp;
										<%
										} else {
										%>
										<a href="index.jsp?pages=<%=l%>">第<%=l%>页</a>&nbsp;
										<%
												}
												}
											} else {
												for (int m = pages - 3; m < pages + 3; m++) {
													if (m == pages) {
										%>
										<font color="#FF0000">第<%=m%>页</font>&nbsp;
										<%
										} else {
										%>
										<a href="index.jsp?pages=<%=m%>">第<%=m%>页</a>&nbsp;
										<%
												}
												}
											}
										%>
										&nbsp;&nbsp;共
										<%=pa%>
										<%=count%>
										条&nbsp;&nbsp;
									</div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</form>

		<form name="form2" method="post" action="act.jsp"
			onSubmit="return check_form(this)">
			<table width="780" border="0" align="center" cellspacing="1"
				bgcolor="#4F7B0D">
				<tr bgcolor="#EFF3E7">
					<td colspan="2">
						<table width="100%" border="0" cellspacing="1">
							<tr>
								<th bgcolor="#4F7B0D">
									<span class="style2">填 写 BUG</span>
								</th>
							</tr>
						</table>
					</td>
				</tr>
				<tr bgcolor="#EFF3E7">
					<td width="459" bgcolor="#EFF3E7">
						<div align="center">
							<table width="100%" border="0">
								<tr>
									<td class="l">
										<div align="center">
											bug内容
											<span class="style1">*</span>
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div align="center">
											<textarea name="text" cols="55" rows="8" id="text"
												style="BORDER: #4F7B0D 1px solid; background: #f8fff7;color: #4F7B0D; overflow:auto;"></textarea>
										</div>
									</td>
								</tr>
							</table>

						</div>
					</td>
					<td width="314" bgcolor="#EFF3E7">
						<table width="98%" border="0" align="center">
							<tr>
								<td class="l">
									<div align="right">
										主题:
									</div>
								</td>
								<td>
									<input name="title" type="text" id="title"
										style="BORDER: #4F7B0D 1px solid;color:#4F7B0D;background: #f8fff7;">
									<span class="style1">*</span>
								</td>
							</tr>
							<tr>
								<td class="l">
									<div align="right">
										提交人:
									</div>
								</td>
								<td>
									<input name="name" type="text" id="name"
										style="BORDER: #4F7B0D 1px solid;color:#4F7B0D;background: #f8fff7;">
									<span class="style1">*</span>
								</td>
							</tr>
							<tr>
								<td class="l">
									<div align="right">
										E-mail:
									</div>
								</td>
								<td>
									<input name="mail" type="text" id="mail"
										style="BORDER: #4F7B0D 1px solid;color:#4F7B0D;background: #f8fff7;">
								</td>
							</tr>
							<tr>
								<td class="l">
									<div align="right">
										Blog:
									</div>
								</td>
								<td>
									<input name="web" type="text" id="web"
										style="BORDER: #4F7B0D 1px solid;color:#4F7B0D;background: #f8fff7;"
										value="http://">
								</td>
							</tr>
							<tr>
								<td class="l">
									<div align="right">
										Q Q:
									</div>
								</td>
								<td>
									<input name="qq" type="text" id="qq"
										style="BORDER: #4F7B0D 1px solid;color:#4F7B0D;background: #f8fff7;">
								</td>
							</tr>
							<tr>
								<th colspan="2">
									<input name="imageField" type="image" src="img/ok1.jpg"
										width="69" height="20" border="0"
										onMouseOut="this.src='img/ok1.jpg'"
										onMouseOver="this.src='img/ok2.jpg'">
									&nbsp;
									<img src="img/back1.jpg" width="69" height="20" border="0"
										onMouseOver="this.src='img/back2.jpg'"
										onMouseOut="this.src='img/back1.jpg'">

								</th>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</form>

		<table width="780" border="0" align="center" cellspacing="1"
			bgcolor="#4F7B0D">
			<tr>
				<td bgcolor="#639A10" class="l">
					<div align="center" class="style2">
						欢迎进入bug管理系统&nbsp;&nbsp;
						<font color="#ffffff">版权所有 &copy;&nbsp;cose.seu 2006</font>
					</div>
				</td>
			</tr>
		</table>
	</body>
</html>

⌨️ 快捷键说明

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