search.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:5k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import="java.util.*"%>
  3. <%@ page import="cn.js.fan.db.Conn"%>
  4. <%@ page import="cn.js.fan.util.*"%>
  5. <%@ page import="cn.js.fan.db.*"%>
  6. <%@ page import="com.redmoon.forum.plugin.auction.*"%>
  7. <%@ page import="com.redmoon.forum.plugin.*"%>
  8. <%@ page import="com.redmoon.forum.person.*"%>
  9. <jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
  10. <html><head>
  11. <meta http-equiv="pragma" content="no-cache">
  12. <LINK href="../../../common.css" type=text/css rel=stylesheet>
  13. <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title><%=Global.AppName%> - 搜索商品</title>
  16. <script language="JavaScript">
  17. <!--
  18. //-->
  19. </script>
  20. <body bgcolor="#FFFFFF" topmargin='0' leftmargin='0'>
  21. <%@ include file="../../inc/header.jsp"%>
  22. <jsp:useBean id="dir" scope="page" class="com.redmoon.forum.plugin.auction.Directory"/>
  23. <%
  24. String what = ParamUtil.get(request, "what");
  25. %>
  26. <br>
  27. <table width="98%" height="227" border='0' align="center" cellpadding='0' cellspacing='0' class="frame_gray">
  28.   <tr> 
  29.     <td height=20 align="left" class="thead"><table width="100%" border="0" class="p9">
  30.           <form name="form_search" method="post" action="search.jsp" onSubmit="">
  31.             <tr> 
  32.               <td height="27" align="center">                <input value="" id="what" name="what" onFocus="" onBlur="" type="text" class="singleboarder" size=16>                &nbsp;
  33.                 <input type="image" value="images/default/search.gif" src="images/default/search.gif" align="middle" width="57" height="16">                </td>
  34.               </tr>
  35.           </form>
  36.         </table>
  37. </td>
  38.   </tr>
  39. <%
  40. int pagesize = 10;
  41. Paginator paginator = new Paginator(request);
  42. AuctionDb ad = new AuctionDb();
  43. String sql = "select msgRootId from " + ad.getTableName() + " where name like " + StrUtil.sqlstr("%" + what + "%") + " order by beginDate desc";
  44. int total = ad.getObjectCount(sql);
  45. paginator.init(total, pagesize);
  46. int curpage = paginator.getCurPage();
  47. //设置当前页数和总页数
  48. int totalpages = paginator.getTotalPages();
  49. if (totalpages==0)
  50. {
  51. curpage = 1;
  52. totalpages = 1;
  53. }
  54. %>  
  55.   <tr> 
  56.     <td valign="top"><br>
  57.       <table width="95%" height="24" border="0" align="center" cellpadding="0" cellspacing="0">
  58.         <tr>
  59.           <td align="right"><div>找到符合条件的记录 <b><%=paginator.getTotal() %></b> 条 每页显示 <b><%=paginator.getPageSize() %></b> 条 页次 <b><%=paginator.getCurrentPage() %>/<%=paginator.getTotalPages() %></b></div></td>
  60.         </tr>
  61.       </table>
  62.       <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFBFF" class="tableframe_gray">
  63.       <tr align="center">
  64.         <td width="18%" height="22">商品名称</td>
  65.       <td width="16%" height="22">卖家姓名</td>
  66.         <td width="17%" height="22">信用值</td>
  67.       <td width="17%">价格</td>
  68.         <td width="15%">销售日期</td>
  69.         <td width="17%">操作</td>
  70.       </tr>
  71. <%
  72. String querystr = "what=" + StrUtil.UrlEncode(what);
  73. Vector v = ad.list(sql, (curpage-1)*pagesize, curpage*pagesize-1);
  74. Iterator ir = v.iterator();
  75. int i = 0;
  76. UserDb user = new UserDb();
  77. while (ir.hasNext()) {
  78. ad = (AuctionDb)ir.next();
  79. i++;
  80. %>
  81.       <tr align="center">
  82.         <td height="28"><%=ad.getName()%> </td>
  83.         <td height="28">
  84. <%
  85. user = user.getUser(ad.getUserName());
  86. %>
  87. <a href="../../../userinfo.jsp?username=<%=StrUtil.UrlEncode(user.getName())%>"><%=user.getName()%></a>
  88. </td>
  89.         <td height="28">
  90. <%=user.getCredit()%>
  91. </td>
  92.       <td height="28"><%
  93. AuctionWorthDb aw = new AuctionWorthDb();
  94. long[] ary = aw.getWorthOfAuction(ad.getMsgRootId());
  95. if (ad.getSellType()==ad.SELL_TYPE_AUCTION) {
  96. aw = aw.getAuctionWorthDb((int)ary[0]);
  97. %>
  98. 底价:<%=aw.getMoneyName()%><%=aw.getPrice()%>&nbsp;<%=aw.getMoneyDanWei()%>
  99. <%} else {
  100. int len = ary.length;
  101. for (int k=0; k<len; k++) {
  102. aw = aw.getAuctionWorthDb((int)ary[k]);
  103. %>
  104. 一口价:<%=aw.getMoneyName()%><%=aw.getPrice()%>&nbsp;<%=aw.getMoneyDanWei()%><BR>
  105. <%}
  106. }%></td>
  107.         <td>
  108.   <%=DateUtil.format(ad.getBeginDate(), "yy-MM-dd")%>
  109.   </td>
  110.         <td height="28">        <a href="../../showtopic.jsp?rootid=<%=ad.getMsgRootId()%>">查看</a></td>
  111.       </tr>
  112. <%}%>   
  113.     </table>
  114.       <table width="87%" border="0" cellspacing="1" cellpadding="3" align="center" class="9black">
  115.         <tr>
  116.           <td height="23"><div align="right">
  117.               <%
  118.     out.print(paginator.getCurPageBlock("?"+querystr));
  119. %>
  120.           </div></td>
  121.         </tr>
  122.       </table>
  123.       <br>
  124.     </td>
  125.   </tr>
  126. </table>
  127. </td> </tr>             
  128.       </table>                                        
  129.        </td>                                        
  130.      </tr>                                        
  131.  </table>                                        
  132.                                
  133. </body>                                        
  134. </html>                            
  135.