📄 view.jsp
字号:
<html>
<head>
<title>view-main</title>
<%@ page contentType="text/html;charset=gb2312" %>
<link rel=stylesheet href="../style.css" type="text/css">
<Script Language=JavaScript>
<!--
function openwindow(pagename){
windowtitle = window.open(pagename, '111', 'toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=yes, copyhistory=no, width=500, height=380');
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF">
<%
String id1;
id1=request.getParameter("mid");
%>
<script LANGUAGE="javascript">
function submit11()
{
self.location.replace("view.jsp?mid=<%=id1%>")
}
</script>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="bidBean" scope="page" class="firm.firm" />
<%
String username = (String) session.getValue("username");
int mid=Integer.parseInt(id1);
session.putValue("pid",id1);
String title;
String sprice;
String nprice;
String qixian;
String info;
String stime;
String amount;
int bids;
int hits;
ResultSet RS = bidBean.executeQuery("SELECT * from product where product_id=" + mid);
if(RS.next()){
title=RS.getString("title");
amount=RS.getString("amount");
qixian=RS.getString("period");
sprice=RS.getString("sprice");
nprice=RS.getString("nprice");
stime=RS.getString("stime");
info=RS.getString("info");
bids=RS.getInt("bids");
hits=RS.getInt("hits");
%>
<table border="1" cellspacing="0" width="548" bgcolor="#F0F8FF" bordercolorlight="#4DA6FF" bordercolordark="#ECF5FF">
<tr>
<td height="0" colspan="4">
<div align="center"><font color="#000099"><b>库存商品信息</b></font></div>
</td>
</tr>
<tbody>
<tr>
<td height="23" width="19%" bgcolor="#FFFFCC"><font color="#006600">商品名称:</font></td>
<td height="23" width="36%"><%=title%></td>
<td height="23" width="17%" bgcolor="#FFFFCC"><font color="#006600">数量:</font></td>
<td height="23" width="28%" ><%=amount%><%session.putValue("amount",amount);%></td>
</tr>
<tr>
<td height="23" width="19%" bgcolor="#FFFFCC"><font color="#006600">拍卖期限:</font></td>
<td height="23" width="36%"><%=qixian%></td>
<td height="23" width="17%" bgcolor="#FFFFCC"><font color="#006600">起始价(元)</font></td>
<td height="23" width="28%" ><%=sprice%></td>
</tr>
<tr>
<td height="23" width="19%" bgcolor="#FFFFCC"><font color="#006600">起始时间:</font></td>
<td height="23" width="36%"><%=stime%></td>
<td height="23" width="17%" bgcolor="#FFFFCC"><font color="#006600">现价(元)</font></td>
<td height="23" width="28%" ><%=nprice%><%session.putValue("nprice",nprice);%></td>
</tr>
<tr>
<td height="23" width="19%" bgcolor="#FFFFCC"><font color="#006600">浏览人次:</font></td>
<td height="23" width="36%"><%=hits%></td>
<td height="23" width="17%" bgcolor="#FFFFCC"><font color="#006600">出价人次:</font></td>
<td height="23" width="28%" ><%=bids%></td>
</tr>
<tr>
<td height="23" width="19%" bgcolor="#FFFFCC"><font color="#006600">商品简介:</font></td>
<td height="23" colspan="3"><%=info%></td>
</tr>
</tbody>
</table>
<%
}
RS.close();
//增加点击数量
String strSQL="update product set hits=hits+1 where product_id=" + mid ;
bidBean.executeUpdate(strSQL);
%>
<br><div align="center"><a href="javascript:openwindow('bid.jsp');">出价</a> <a href="mailto:service@localhost">投诉</a> </div><br>
<%
//指定行数
int pageLine=5;
int totalRec=0;
int totalSub=0;
int intPage=1;
int i;
if (request.getParameter("page")!=null)
intPage=Integer.parseInt(request.getParameter("page"));
try{
ResultSet countRS1=null;
//取得总记录数
String sqlstr="select count(*) as cnt from bid where product_id="+ mid;
countRS1=bidBean.executeQuery(sqlstr);
if (countRS1.next())
totalRec=countRS1.getInt("cnt");
countRS1.close();
bidBean.closeStmt();
}
catch(Exception e){
e.printStackTrace();
}
//取得总页数
int intPageCount=0;
intPageCount = (totalRec+pageLine-1) / pageLine;
%>
<%
ResultSet RS1 = bidBean.executeQuery("SELECT * FROM bid where product_id="+ mid +" order by new_price desc");
String serial;
String bidman;
String nprice1;
String amount1;
String info1;
Date posttime;
%>
<table border="1" cellspacing="0" width="548" bgcolor="#F0F8FF" bordercolorlight="#4DA6FF" bordercolordark="#ECF5FF">
<div align="center">
<font color="#000099"><b>投标过程</b></font>
</div>
<tr bgcolor='#000099' align='center'>
<td width="12%" align="center" ><font color="#FFFFFF">买方</font></td>
<td width="14%" align="center" ><font color="#FFFFFF">最新出价</font></td>
<td width="14%" align="center" ><font color="#FFFFFF">出价时间</font></td>
<td width="8%" align="center" ><font color="#FFFFFF">数量</font></td>
<td width="8%" align="center" ><font color="#FFFFFF">状态</font></td>
<td width="28%" align="center" ><font color="#FFFFFF">出价人留言</font></td>
</tr>
<%
if (intPageCount>0)
{
for(i=1;i<=(intPage-1)*pageLine;i++)
RS1.next();
for(i=1;i<=pageLine;i++) {
if (RS1.next()) {
serial=RS1.getString("msgid");
bidman=RS1.getString("bidman");
nprice1=RS1.getString("new_price");
amount1=RS1.getString("amount");
info1=RS1.getString("word");
posttime=RS1.getDate("bidtime");
%>
<tr>
<td width="12%" align="center"><%=bidman%></td>
<td width="14%" align="center"><%=nprice1%></td>
<td width="14%" align="center"><%=posttime%></td>
<td width="8%" align="center"><%=amount1%></td>
<%
String nprice0 = (String) session.getValue("nprice");
int np0=Integer.parseInt(nprice0);
int np1=Integer.parseInt(nprice1);
%>
<td width="8%" align="center">
<%if(np0<=np1)
out.print ("领先");
else
out.print ("出局");
%>
</td>
<td width="28%"><%=info1%></td>
</tr>
<%
}
}
RS1.close();
}
%>
<!--以下用于分页显示 -->
<%
out.print("<tr>");
if (intPageCount*pageLine<totalRec)
intPageCount++;
if (intPage>intPageCount )
intPage=intPageCount;
if (intPage < 1 )
intPage=1;
out.print("<form method='POST' name=fPageNum action='view.jsp'>");
out.print("<p align='left'>>>分页 ");
if (intPage<2)
out.print("<font color='999966'>首页 上一页</font> ");
else{
out.print("<a href='view.jsp?page=1&mid="+mid+"'>首页</a> ");
out.print("<a href='view.jsp?page=" + (intPage-1) + "&mid="+mid+"'>上一页</a> " );
}
if( intPage-intPageCount>=0 )
out.print("<font color='999966'>下一页 尾页</font>" );
else{
out.print("<a href='view.jsp?page=" + (intPage+1)+ "&mid="+mid+"'>下一页</a> <a href='view.jsp?page=" + intPageCount + "&mid="+mid+"'>尾页</a>");
}
out.print(" 页次:<font color=red>"+intPage+"</font>/"+intPageCount+"页 " );
out.print(" 共<b>"+totalRec+"</b>条记录 <b>"+pageLine+"</b>条/页 " );
out.print(" 转到第<input type='text' name='page' size=2 maxlength=10 class=smallInput value="+intPage+">");
out.print("页<input class=buttonface type='submit' value='确定' name='cndok'></span></p></form>" );
out.print("</td>");
out.print("</tr>");
%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -