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

📄 shopcontrol.jsp

📁 一个仿造淘宝的jsp网站。功能比较完善
💻 JSP
字号:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.jc.taobao.gjj.entity.*" %>
<%@ page import="com.jc.taobao.gjj.logic.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'Shopcontrol.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

    <link href="CSS/manager.css" rel="stylesheet" type="text/css">
    <style type="text/css">
<!--
.style1 {
	font-size: 14px;
	font-weight: bold;
}
.style4 {color: #000000}
.style5 {font-size: 14px}
.style7 {color: #000000; font-size: 13px; }
-->
    </style>
	<script type='text/javascript' src='/taobao/dwr/interface/typebean.js'></script>
	 <script type='text/javascript' src='/taobao/dwr/interface/statebean.js'></script>
  <script type='text/javascript' src='/taobao/dwr/engine.js'></script>
  <script type='text/javascript' src='/taobao/dwr/util.js'></script>
  
  <script type="text/javascript">
   function  loadselect()
   {
     typebean.getAlltypename(loadme);
   }
   function loadme(array)
   {
       DWRUtil.addOptions('selecttype',array);
   }
   function  loadselectstate()
   {
     statebean.GetAllStateName(loadmestate); 
   }
   function loadmestate(array)
   {
       DWRUtil.addOptions('selectstate',array);
   }
   function formservletbyprice()
   {
      if(document.getElementById("shopprice1").value==""||document.getElementById("shopprice2").value=="")
      {
        alert("不能为空!");
        document.getElementById("shopprice1").value=="";
        document.getElementById("shopprice2").value=="";
        return;
      }
      if(isNaN(document.getElementById("shopprice1").value)||isNaN(document.getElementById("shopprice2").value))
      {
         alert("必须是数字");
         document.getElementById("shopprice1").value=="";
         document.getElementById("shopprice2").value=="";
         return;
      }
      if(document.getElementById("shopprice1").value>document.getElementById("shopprice2").value)
      {
         alert("后者必须要比前者大!");
         document.getElementById("shopprice1").value=="";
         document.getElementById("shopprice2").value=="";
         return;
      }
      document.form5.submit();
   }
   function tijiao1()
   {
     if(document.getElementById("selectshopbyshopname").value=="")
     {
       alert("不能为空!");
       return;
     }
     document.form1.submit();
   }
   function tijiao2()
   {
     if(document.getElementById("selectshopbyshopmake").value=="")
     {
       alert("不能为空!");
       return;
     }
     document.form3.submit();
   }
  </script>
  </head>
  
  <body onLoad="loadselect(),loadselectstate()">
    
    <div id="managerfrontrightnum2buttom">
	   <div id="managerfrontrightnum1"><span class="style1">商品查询</span></div>
	   
	        <div id="shoptopselect">
	          <table width="698" height="65" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #6699CC;">
                <tr bgcolor="#DCE2F0" style="border:1px solid #6699CC;">
                  <td width="140" height="19"><div align="center"><span class="style7">根据名称查</span></div></td>
                  <td width="136"><div align="center"><span class="style7">根据类别查</span></div></td>
                  <td width="147"><div align="center"><span class="style7">根据产地查</span></div></td>
                  <td width="132"><div align="center"><span class="style7">根据状态查</span></div></td>
                  <td width="143"><div align="center"><span class="style7">根据价格查</span></div></td>
                </tr>
                <tr>
                  <td height="50" bgcolor="#ECF4FF"><form name="form1" method="post" action="servlet/ShopSUD1Servlet">
<input type="text" name="selectshopbyshopname" id="selectshopbyshopname" style="width:90px; ">                    
<input type="button" name="Submit" onclick="javascript:tijiao1()" value="提交">
                  </form></td>
                  <td  bgcolor="#ECF4FF"><form name="form2" method="post" action="servlet/ShopSUD1ByTypeServlet">
<select name="selecttype" style="width:80px; ">
</select>                    
<input type="submit" name="Submit" value="提交">
                  </form></td>
                  <td  bgcolor="#ECF4FF"><form name="form3" method="post" action="servlet/ShopSUD1ByshopmakeServlet">
                    <input type="text" name="selectshopbyshopmake" style="width:90px; ">
                    <input type="button" name="Submit"  onclick="javascript:tijiao2()" value="提交">
                  </form></td>
                  <td bgcolor="#ECF4FF"><form name="form4" method="post" action="servlet/ShopSUD1ByStateServlet">
                    <select name="selectstate" style="width:80px; ">
                    </select>
                    <input type="submit" name="Submit" value="提交">
                  </form></td>
                  <td  bgcolor="#ECF4FF"><form name="form5" method="post" action="servlet/ShopSUD1ByshoppriceServlet">
                    <input type="text" name="shopprice1" id="shopprice1" style="width:40px; ">
                    <input type="text" name="shopprice2" id="shopprice2" style="width:40px; ">
                    <input type="button" name="Submit" onclick="javascript:formservletbyprice()" value="提交">
                  </form></td>
                </tr>
              </table>
</div>
			<div id="shopselect">
			<div id="shopshow">
			<%!
				int intpagesize=7;//每页显示的记录数
				int intpagetotal;//总页数
				int currpagebegin;//起始记录索引
				int intpage;//要显示的页数
				String strpage;//用户请求的页数
				int count;//有多少条记录
			
			 	%>
			 		<%
			 		ArrayList alshop=(ArrayList)session.getAttribute("selectshopbyshopnameal");
			 		
			 		if(alshop!=null)
                    {
			 		count=alshop.size();//计算出有多少条记录
			 		intpagetotal=count%intpagesize==0?count/intpagesize:count/intpagesize+1;//计算出总页数
			 		strpage=request.getParameter("pagenumber");
			 		if(strpage==null)
			 		{
			 			intpage=1;
			 		}
			 		else
			 		{
			 			intpage=Integer.parseInt(strpage);
			 			if(intpage<1)
			 			{
			 				intpage=1;
			 			}
			 		}
			 		if(intpage>intpagetotal)
			 		{
			 		intpage=intpagetotal;
			 		}
			 	currpagebegin=intpage*intpagesize-intpagesize;
			 	 %>
      <table width="697" height="82" border="0" cellpadding="0" cellspacing="0" id="table">
        <tr bgcolor="#DCE2F0">
          <td height="41" class="style7">商品编号</td>
          <td class="style7">商品名称</td>
          <td class="style7">商品类型</td>
          <td class="style7">商品价格</td>
          <td class="style7">商品产地</td>
          <td class="style7">商品图片</td>
          <td class="style7">商品状态</td>
          <td class="style7">商品描述</td>
        </tr>
        
			 
		 <% 
         
         for(int i=currpagebegin;i<intpage*intpagesize && i<count;i++)
        { 
          ShopInfo shop=(ShopInfo)alshop.get(i);
          
          
          /*根据类型编号查出类型名称*/
          TypeInfoBean tbean=new TypeInfoBean();
         ArrayList altype=(ArrayList)tbean.getquerybyTID(Integer.valueOf(shop.getTid()));
         TypeInfo type=(TypeInfo)altype.get(0);
         
         /*根据状态编号查出状态名称*/
         StateInfoBean statebean=new StateInfoBean();
         StateInfo state=new StateInfo();
         state.setStateid(shop.getStateid());
         ArrayList alstate=(ArrayList)statebean.getquerybystateid(state);
         StateInfo sta=(StateInfo)alstate.get(0);
        %>
        <tr bgcolor="#DCE2F0">
          <td width="68" height="41" class="style7"><div align="center"><%=shop.getSid() %></div></td>
          <td width="69" class="style7"><div align="center"><%=shop.getShopname() %></div></td>
          <td width="69" class="style7"><div align="center"><%=type.getTypename() %></div></td>
          <td width="80" class="style7"><div align="center"><%=shop.getPrice() %></div></td>
          <td width="69" class="style7"><div align="center"><%=shop.getShopmake() %></div></td>
          <td width="74" class="style7"><div align="center"><img src="<%=shop.getShopphoto()  %>" width="50" height="50"></div></td>
          <td width="74" class="style7"><div align="center"><%=sta.getStatename() %></div></td>
          <td width="124" class="style7"><div align="center"><%=shop.getShopdesc() %></div></td>
        </tr>
		 <%} %>
		  
		 <%} %>
      </table><font style="font-size: 14px;">
      共<%=count %>条记录
      第<%= intpage %>页 共<%= intpagetotal %>页
			    <%if(intpage>1){ %>
			    <a href="Shopcontrol.jsp?pagenumber=<%=intpage-1 %>">上一页</a>
			    <%}else{ %>
			    上一页
			    <%} %>
			    <%if(intpage<intpagetotal){ %>
			    <a href="Shopcontrol.jsp?pagenumber=<%=intpage+1 %>">下一页</a>
			    <%}else{ %>
			    下一页
			    <%}%>
			    </font>
       </div>
      
      </div>
	</div>
  </body>
</html>

⌨️ 快捷键说明

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