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

📄 through_no.jsp

📁 用JSP写的一个在线购物网站的代码
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312" import="java.sql.*" %>
<jsp:useBean id="data" scope="page" class="shop.data.conn" />
<%
String admin=(String)session.getValue("admin");
if(admin=="" || admin==null)
{%>
<script language="javascript">
alert("请登陆后再执行管理操作");
self.location="index.jsp";
</script>
<%}else{
String sql="select * from admin where admin='"+admin+"'";
ResultSet rs=data.executeQuery(sql);
if(!rs.next())
{%>
<script language="javascript">
alert("对不起,无此管理员帐号");
history.back();
</script>
<%}}%>
<style type="text/css">
<!-- @import url(../images/css.css); -->
</style>
<script language="JavaScript">
function check()
{
 if(document.form.relapse.value.length==0)
 {
    alert("请填写回复内容");
	document.form.relapse.focus();
	return false;
 }
}
</script>
<%
String through=request.getParameter("through");
if(through!="" && through!=null)
{
java.util.Date today=new java.util.Date();
String addtime=today.toLocaleString();
String sql="update dingdan set censor_yes='"+"1"+"',throughtime='"+addtime+"' where dingdanid='"+through+"'";
ResultSet rs=data.executeQuery(sql);
response.sendRedirect("through_no.jsp");
}
%>
<%
String del=request.getParameter("del");
if(del!="" && del!=null)
{
String sql="delete from dingdan where dingdanid='"+del+"'";
ResultSet rs=data.executeQuery(sql);
sql="delete from buyware where buyid='"+del+"'";
rs=data.executeQuery(sql);
response.sendRedirect("through_no.jsp");
}
%>
<table width="430" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="80" height="25" bgcolor="3969A5"><div align="center"><font color="#FFFFFF">定单号</font></div></td>
    <td width="80" bgcolor="3969A5"><div align="center"><font color="#FFFFFF">提交人</font></div></td>
    <td width="150" bgcolor="3969A5"><div align="center"><font color="#FFFFFF">提交时间</font></div></td>
    <td width="40" bgcolor="3969A5"><div align="center"><font color="#FFFFFF">查看</font></div></td>
    <td width="40" bgcolor="3969A5"><div align="center"><font color="#FFFFFF">删除</font></div></td>
    <td width="40" bgcolor="3969A5"><div align="center"><font color="#FFFFFF">审核</font></div></td>
  </tr>
</table>
<table width="430" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr>
    <td>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
	<tr bgcolor="#FFFFFF">
	<td height="10" colspan="6"></td>
	</tr>
	<%
	int pagesize=15;
	int allcount;
	int allpage;
	int intpage;
	int i;
	String strpage=request.getParameter("page");
	if(strpage==null)
	{
	intpage=1;
	}else{
	intpage=Integer.parseInt(strpage);
	if(intpage<1) intpage=1;
	}
	String sql="select id,dingdanid,buyid,actiontime from dingdan where censor_yes='"+"0"+"' and preordainShop='"+"0"+"' order by id desc";
	ResultSet rs=data.executeQuery(sql);
	int all=0;
	while(rs.next())
	{ all++; }
	allcount=all;
	allpage=(allcount+pagesize-1)/pagesize;
	if(intpage>allpage) intpage=allpage;
	if(allpage>0)
	{
	rs.absolute((intpage-1)*pagesize+1);
	int dingdanid=rs.getInt("dingdanid");
	String buyid=rs.getString("buyid");
	%>
	<tr bgcolor="#FFFFFF">
	<td width="80" height="20"><div align="center"><a href="through_no.jsp?see=<%=dingdanid%>"><%=dingdanid%></a></div></td>
	<td width="80"><div align="center"><a target="_blank" href="user.jsp?id=<%=buyid%>"><%=buyid%></a></div></td>
	<td width="150"><div align="center"><%=rs.getString("actiontime").substring(0,16)%></div></td>
	<td width="40"><div align="center"><a href="through_no.jsp?see=<%=dingdanid%>"><font color="#FF0000">查看</font></a></div></td>
	<td width="40"><div align="center"><a href="through_no.jsp?del=<%=dingdanid%>"><font color="#FF0000">删除</font></a></div></td>
	<td width="40"><div align="center"><a href="through_no.jsp?through=<%=dingdanid%>"><font color="#FF0000">审核</font></a></div></td>
	</tr>
	<%
	i=1;
	dingdanid=0;
	buyid="";
	String actiontime="";
	while(i<pagesize &&rs.next())
	{
	dingdanid=rs.getInt("dingdanid");
	buyid=rs.getString("buyid");
	actiontime=rs.getString("actiontime").substring(0,16);
	%>
	<tr bgcolor="#FFFFFF">
	<td width="80" height="20"><div align="center"><a href="through_no.jsp?see=<%=dingdanid%>"><%=dingdanid%></a></div></td>
	<td width="80"><div align="center"><a target="_blank" href="user.jsp?id=<%=buyid%>"><%=buyid%></a></div></td>
	<td width="150"><div align="center"><%=actiontime%></div></td>
	<td width="40"><div align="center"><a href="through_no.jsp?see=<%=dingdanid%>"><font color="#FF0000">查看</font></a></div></td>
	<td width="40"><div align="center"><a href="through_no.jsp?del=<%=dingdanid%>"><font color="#FF0000">删除</font></a></div></td>
	<td width="40"><div align="center"><a href="through_no.jsp?through=<%=dingdanid%>"><font color="#FF0000">审核</font></a></div></td>
	</tr>
	<%
	i++;
	}}%>
	<tr bgcolor="#FFFFFF">
	<td height="10" colspan="6"></td>
	</tr>
	</table>
	</td>
  </tr>
</table>
<table width="430" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="25" bgcolor="3969A5"></td>
  </tr>
</table>
<form action="" method="post">
<div align="center">当前<font color="#FF0000"><%=intpage%></font>/<font color="#FF0000"><%=allpage%></font>页,每页<font color="#FF0000"><%=pagesize%></font>条
<%if(intpage>1)
 {
if(intpage==1)
 {%>
  <a href="through_no.jsp?page=<%=intpage-1%>">上一页 </a> 
  <%} else{%>
  <a href="through_no.jsp?page=<%=1%>">最前页</a><a href="through_no.jsp?page=<%=intpage-1%>"> 上一页</a> 
  <%}}%>
  <%
if(intpage<allpage)
 {
  if(intpage==allpage)
 {%>
  <a href="through_no.jsp?page=<%=intpage+1%>">下一页</a> 
  <%}else{%>
  <a href="through_no.jsp?page=<%=intpage+1%>">下一页 </a><a href="through_no.jsp?page=<%=allpage%>">最后页</a> 
  <%}}%>
  </div>
</form>
<br><br><br><br>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
<%
String see=request.getParameter("see");
if(see!="" && see!=null)
{
%>
<tr bgcolor="3969A5">
<td height="25" colspan="4"><div align="center"><font color="#FFFFFF">商品信息</font></div></td>
</tr>
<tr bgcolor="#CCCCCC">
<td height="25" width="150"><div align="center">商品名</div></td>
<td width="40"><div align="center">数量</div></td>
<td width="55"><div align="center">单价</div></td>
<td width="55"><div align="center">总计</div></td>
</tr>
<%
sql="select id,warename,wareid,number,price from buyware where buyid='"+see+"'";
rs=data.executeQuery(sql);
String warename="";
int wareid=0;
int number=0;
int price=0;
int allprice=0;
while(rs.next())
{
warename=rs.getString("warename");
wareid=rs.getInt("wareid");
number=rs.getInt("number");
price=rs.getInt("price");
%>
<tr bgcolor="#FFFFFF">
<td width="150" height="20"><div align="center"><a target="_blank" href="../wareshow.jsp?action=<%=wareid%>"><%=warename%></a></div></td>
<td width="40"><div align="center"><%=number%></div></td>
<td width="55"><div align="center"><%=price%>元</div></td>
<td width="55"><div align="center"><%=number*price%>元</div></td>
</tr>
<%
allprice+=number*price;
}%>
<tr bgcolor="3969A5">
<td height="25" colspan="4"><div align="center"><font color="#FFFFFF">商品价格总计:</font><font color="#FFFF00"><%=allprice%>元</font></div></td>
</tr>
<tr>
<td height="20" bgcolor="#FFFFFF" colspan="4"></td>
</tr>
<tr>
</td>
<%
sql="select id,dingdanid,buyid,explain,actiontime from dingdan where dingdanid='"+see+"'";
rs=data.executeQuery(sql);
if(rs.next())
{
int dingdanid=rs.getInt("dingdanid");
String buyid=rs.getString("buyid");
String explain=rs.getString("explain");
String actiontime=rs.getString("actiontime").substring(0,16);
%>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="25" bgcolor="3969A5" colspan="3"><div align="center"><font color="#FFFFFF">定单信息</font></div></td>
</tr>
<tr>
<td height="15"></td>
</tr>
<tr>
<td width="100" height="20"><div align="right">定单号:</div></td>
<td width="10"></td>
<td width="190"><font color="#FF0000"><%=dingdanid%></font></td>
</tr>
<tr>
<td height="20"><div align="right">购买者ID:</div></td>
<td></td>
<td><a target="_blank" href="user.jsp?id=<%=buyid%>"><font color="#FF0000"><%=buyid%></font></a></td>
</tr>
<tr>
<td><div align="right">定单说明:</div></td>
<td></td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10"></td>
</tr>
</table>
<textarea cols="30" rows="8" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva"><%=explain%></textarea>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="20"><div align="right">提交时间:</div></td>
<td></td>
<td><%=actiontime%></td>
</tr>
<tr>
<td height="15"></td>
</tr>
<tr>
<td height="25" bgcolor="3969A5" colspan="3"></td>
</tr>
</table>
<%}%>
</td>
</tr>
<tr>
<td>
<form action="" method="post" name="form" onSubmit="return check()">
<input type="hidden" name="addrelapse" value="">
<input type="hidden" name="id" value="<%=see%>">
<table align="center" width="300" cellpadding="0" cellspacing="0" border="0">
<tr>
<td height="25" bgcolor="3969A5" colspan="3"><div align="center"><font color="#FFFFFF">回复定单</font></div></td>
</tr>
<tr>
<td height="15"></td>
</tr>
<tr>
<td height="20" width="100"><div align="right">回复定单:</font></td>
<td width="10"></td>
<td width="190">
<%
sql="select relapse from dingdan where dingdanid='"+see+"'";
rs=data.executeQuery(sql);
rs.next();
String relapse=rs.getString("relapse");
rs.close();
%>
<textarea name="relapse" cols="30" rows="10" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva"><%=relapse%></textarea></td>
</tr>
<tr>
<td height="30" colspan="3"><div align="center"><input type="submit" value="回复" onClick="document.all.addrelapse.value='true';" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva">
                                                                                    <input type="reset" value="重写" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva"></div></td>
</tr>
<tr>
<td height="15"></td>
</tr>
<tr>
<td height="25" bgcolor="3969A5" colspan="3"></td>
</tr>
</table>
</form>
<%}%>
<td>
</tr>
</table>
<%
String addrelapse=request.getParameter("addrelapse");
if(addrelapse!=null && addrelapse.equals("true"))
{
String relapse=request.getParameter("relapse");
relapse=new String(relapse.getBytes("ISO8859_1"),"GBK");
String id=request.getParameter("id");
sql="update dingdan set relapse='"+relapse+"' where dingdanid='"+id+"'";
rs=data.executeQuery(sql);
response.sendRedirect("through_no.jsp");
}
%>

⌨️ 快捷键说明

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