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

📄 manage_order.jsp

📁 本例讲述了如何使用JSP技术编写在线商务沟通系统
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="connManager" class="com.ConnManager" scope="application" />
<%
  String UserName=session.getValue("UserName");
  if (UserName==null)
	 response.sendRedirect("login.jsp");	

Connection con = connManager.getConnection("cart");
if(con==null)
{
%>对不起,现在数据库忙,请稍后再试<%
}
Statement stmt = con.createStatement();

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理订单页面</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
	color: #6666FF;
}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
-->
</style></head>

<body>
<%

	int pagesize=4; 
  	int rowcount=0;
	int pagecount=0;
	String sql="select * from order where Status='"+2+"'";
	ResultSet rs=stmt.executeQuery(sql); 
	if(!rs.next()){
%>
    <script language="javascript">
	alert("没有未执行订单");
	window.location.href="main.jsp"
   </script>
    
<table width="650" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <th height="27" background="image/admin_bg_1.gif" scope="col"><img src="image/order.gif" width="100" height="25"></th>
  </tr>
  <tr>
    <th height="49" background="image/admin_bg.gif" scope="row"><table width="650" height="53" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <th width="58" height="16" scope="col">订单号</th>
        <th width="51" scope="col">用户名</th>
        <th width="70" scope="col">真实姓名</th>
        <th width="62" scope="col">订购时间</th>
        <th width="111" scope="col">邮件</th>
        <th width="82" scope="col">电话</th>
        <th width="72" scope="col">支付方式</th>
        <th width="73" scope="col">运货方式</th>
        <th width="71" scope="col">删除否</th>
      </tr>
<% 
		 for(int i=1;i<=pagesize;i++){
  %>
      <tr>
        <th height="18" scope="row">
   <a href="order_detail.jsp?id=<%=rs.getString(1)%>"><%==rs.getString(1)%>;
       </th>
        <td><%=rs.getString(2)%></td>
        <td><%=rs.getString(3)%></td>
        <td><%=rs.getString(5)%></td>
        <td><%=rs.getString(6)%></td>
        <td><%=rs.getString(9)%></td>
        <td><%=rs.getString(10)%></td>
        <td><%=rs.getString(11)%></td>
        <td><div align="center">
        <a href="del_order.jsp?id=<%=rs.getString(1)%>">删除</a>
        </div></td>
      </tr>
    <%
  	if(!rs.next())
		break;
  	} 
%>
      <tr>
        <th height="19" colspan="9" scope="row">
    <a href="manage_order.jsp?topage=<%=1%>">第一页</a>
	<a href="manage_order.jsp?topage=<%=showpage-1%>">上一页</a>
	<a href="manage_order.jsp?topage=<%=showpage+1%>">下一页</a>
	<a href="manage_order.jsp?topage=<%=pagecount%>">最后一页</a>
    <input name="topage" type="text" class="txt_grey" size="5" value="<%=showpage%>">
     <%
	}else{
	rs.last();
	rowcount=rs.getRow();
	int showpage=1;
  	pagecount=((rowcount%pagesize)==0?(rowcount/pagesize):(rowcount/pagesize)+1);
  	String topage=request.getParameter("topage");
	 if(topage!=null){
  	showpage=Integer.parseInt(topage);
	if(showpage>pagecount){
		showpage=pagecount;
	}else if(showpage<=0){
		showpage=1;
	}
  }
  rs.absolute((showpage-1)*pagesize+1);
  %>
</th>
        </tr>
<%
  }
    rs.close();
    stmt.close();
    connManager.releaseConnection("cart",con);

%>
    </table></th>
  </tr>
  <tr>
    <th height="10" background="image/admin_bg_1.gif" scope="row">&nbsp;</th>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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