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

📄 masview.jsp

📁 jsp编程jsp工程项目与实践 jsp源代码
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="../error/error.jsp" %>
<!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>
<title>察看留言</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rel="stylesheet" type="text/css" href="../image/com.css"/>
<script language="JavaScript" src="../image/com.js"></script>
<jsp:useBean id="con" class="useBean.Link_db" scope="request" />
<body>
<table width="732" height="*" border="1" align="center" cellpadding="1" cellspacing="0" bordercolordark="#ffffff"  bordercolor="#ffffff" bordercolorlight="#0066ff">
  <tr bgcolor="#CCCCFF">
    <td height="22" colspan="5" align="center"><a href="#" class="style10" onclick="openmas()">增加留言</a></td>
  </tr>
<%	
	String sqli=" SELECT * FROM mas ORDER BY 留言id DESC";
	Connection conn=useBean.Link_db.getCon();
	Statement state=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
	ResultSet rs=state.executeQuery(sqli);
	String temp=(String)session.getAttribute("admin");
	String color="";
	//countpage总页数,sqan宽度,count总纪录数,fpage现在页,fcount现纪录数
	String strpages=(String)request.getParameter("pages");
	int pages=0;
	if(strpages==null){
		pages=0;
	}else{
		pages=Integer.parseInt(strpages);
	}
	rs.last();
	int sqan=4,i=0,fcount=0;
	int count=rs.getRow();
	int countpage=count/sqan;
	if(count%sqan>0) countpage=countpage+1;
	if(pages<0) pages=0;
	if(pages>countpage-1) pages=countpage-1;
		fcount=pages*sqan+1;
	int fpage=(count-fcount)/sqan+1;
		rs.absolute(fcount);
		rs.previous();
	while(rs.next()){
		int id=rs.getInt("留言id");
		String username=rs.getString("留言人");
		String time=rs.getString("留言时间");
		String topic=rs.getString("留言主题");
		String email=rs.getString("留言人Email");
		String masinfo=rs.getString("留言内容");
	
		if(masinfo==null) masinfo="";
			if(color==""){
				color="#ffffff";
			}else{
				color="";
			}
%>
  <tr bgcolor="<%=color%>">
    <td align="center" width="64" height="22">留言人:</td>
    <td align="center" width="169"><%=username%>&nbsp;</td>
    <td height="22"  colspan="2" align="left">留言主题:</td>
    <td width="418" height="22" align="center"><%=topic%>&nbsp;</td>
  </tr>
  <tr bgcolor="<%=color%>">
    <td width="64" height="22" align="center">日期:</td>
    <td width="169" height="22" align="center"><%=time%></td>
    <td height="22" colspan="3" rowspan="3" align="left" valign="top"><%=masinfo%>&nbsp;</td>
  </tr>
  <tr bgcolor="<%=color%>">
    <td height="22" align="center">Email:</td>
    <td height="22" align="center"><%=email%>&nbsp;</td>
  </tr>
  <tr bgcolor="<%=color%>">
    <td height="22" align="center">处理:</td>
    <td height="22" align="center"><a href="mas_del.jsp?id=<%=id%>" >删除留言</a></td>
<%	
	i++;if(i==sqan) break;
		}
	try{
		con.close();
		conn.close();
	}catch(Exception e){
	}
%>
  </tr>
  <tr align="right" bgcolor="#CCCCFF">
    <td height="22" colspan="5">第<%=(pages+1)%>/<%=countpage%>页&nbsp;&nbsp;<a href="masview.jsp?pages=<%=(pages-1)%>">上一页</a>&nbsp;&nbsp;<a href="masview.jsp?pages=<%=(pages+1)%>">下一页</a></td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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