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

📄 selectware.jsp

📁 用JSP写的一个在线购物网站的代码
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%@ page contentType="text/html;charset=gb2312" import="java.sql.*,java.util.*,shop.buy.buy" %>
<jsp:useBean id="data" scope="page" class="shop.data.conn" />
<style type="text/css">
<!-- @import url(images/css.css); -->
</style>
<script language="JavaScript">
function wareshow(a)
{
  window.open("wareshow.jsp?action="+a,"body","scrollbars=yes,width=434,height=500");
}
</script>
<body bgcolor="#63bce6" leftmargin="0" topmargin="0">
<table border=0 cellPadding=0 cellSpacing=0 width=770>
  <tr height=7 background="images/main_top_line.gif"> 
    <td colSpan=3 height=7></td>
  </tr>
  <tr> 
    <td background="images/main_left_line.gif" width=7></TD>
    <td vAlign=top> <table width="756" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td height="95" valign="middle"><%@ include file="top.jsp"%></td>
        </tr>
        <tr> 
          <td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
              <tr> 
                <td width="165"><%@ include file="left.jsp" %></td>
                <td width="14"></td>
                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td height="25"><div align="right" class="darkbluetext"> 
                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr> 
                              <td width="560" height="25"><div align="right">HOME 
                                  > <font color="#FF0000">商品搜索</font></div></td>
                              <td>&nbsp;</td>
                            </tr>
                          </table>
                        </div></td>
                    </tr>
                    <tr> 
                      <td height="20">&nbsp;</td>
                    </tr>
                    <tr> 
                      <td> <%
                      String nameclass="";
                      String classid="";
                      String tj="";
					  String tjname="";
                      String selclass=request.getParameter("selclass");
                      if(selclass.equals("all"))
                      {
                      classid=""; 
                      nameclass="所有分类";
                      }
                      else{
                      sql="select * from class_small where id='"+selclass+"'";
                      rs=data.executeQuery(sql);
                      rs.next();
                      bigid=rs.getInt("bigid");
                      int smallid=rs.getInt("smallid");
                      nameclass=rs.getString("name").trim();
                      rs.close();
                      classid=" class_small='"+smallid+"' and class_big='"+bigid+"' and ";
                      }
                      String price=request.getParameter("price");
                      String selmode=request.getParameter("selmode");
                      String warename=request.getParameter("warename");
					  warename=new String(warename.getBytes("ISO8859_1"),"GBK");
                      if(selmode.equals("name"))
                      {
					  tj=" warename like '%"+warename+"%' ";
					  tjname="商品名称";
					  }
                      if(selmode.equals("produce"))
                      {
					  tj=" produce like '%"+warename+"%' ";
					  tjname="生产厂家";
					  }
                      if(selmode.equals("simplicity"))
                      {
					  tj=" explain like '%"+warename+"%' ";
					  tjname="商品简要介绍";
					  }
                      sql="select * from ware where "+classid+"managerprice<"+price+" and "+tj+"order by id desc";
                      %> <table width="560" height="35" border="0" cellpadding="0" cellspacing="0" background="images/selectware.gif">
                          <tr> 
                            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr> 
                                  <td width="90"></td>
                                  <td height="25"><font color="#FF0000"><%=nameclass%>-><%=price%>元以下-><%=tjname%>-><%=warename%></font></td>
                                </tr>
                                <tr> 
                                  <td height="10"></td>
                                  <td></td>
                                </tr>
                              </table></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr> 
                      <td><table border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            <td width="560" height="20"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr> 
                                  <td height="20"></td>
                                </tr>
                                <tr> 
                                  <td> <%
								  int pagesize=8;
								  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;
								  }
								  rs=data.executeQuery(sql);
								  rs.last();
								  allcount=rs.getRow();
								  allpage=(allcount+pagesize-1)/pagesize;
								  if(intpage>allpage) intpage=allpage;
								  if(allpage>0)
								  {
								  rs.absolute((intpage-1)*pagesize+1);
								  id=rs.getInt("id");
                                  String name=rs.getString("warename");
                                  String explain=rs.getString("explain");
                                  int marketprice=rs.getInt("marketprice");
                                  int managerprice=rs.getInt("managerprice");
                                  int vipprice=rs.getInt("vipprice");
                                  String small_pic=rs.getString("small_pic");
								  %> <table width="540" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">

⌨️ 快捷键说明

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