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

📄 a_layout.jsp

📁 hibernate做的一个网上商店系统
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" import="java.util.*,mrgf.hibernate.*" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<jsp:useBean id="hn" class="mrgf.other.Hibernate" scope="request"/>
<html>
<link rel="stylesheet" href="css/style.css">
<style type="text/css">
<!--
.style1 {color: #CC33FF}
.style2 {color: #000000}
-->
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>
index
</title>
</head>
<body bgcolor="#ffffff" topmargin="0">
  <script language="javascript" type="">
  <!--
  function checkEmptySearch(formName){
    for(i=0;i<formName.length;i++){
      if(formName.elements[i].value==""){
        alert("请认真填写商品信息!!!");
        return false;
      }
    }
  }
  function checkEmptyLand(formName){
    for(i=0;i<formName.length;i++){
      if(formName.elements[i].value==""){
        alert("请认真填写登录信息!!!");
        return false;
      }
    }
  }
  function controlAlign(){
    width=screen.width;
    height=screen.height;
    var hdc=window.open('findPassword.do','','width=400,height=200');
    hdc.moveTo((width-400)/2,(height-200)/2);
  }
  function controlLandAlign(){
    width=screen.width;
    height=screen.height;
    var hdc=window.open('managerLand.do','','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=600,height=400');
    hdc.moveTo((width-600)/2,(height-400)/2);
  }
  function controlAfficheAlign(id){
    width=screen.width;
    height=screen.height;
    var hdc=window.open("seeAffiche.do?afficheId="+id,"","scrollbars=yes,width=600,height=400");
    hdc.moveTo((width-600)/2,(height-400)/2);
  }
  //-->
  </script>
<table width="983" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="113" rowspan="5">&nbsp;</td>
    <td colspan="2"><img src="image/layout/top.jpg" width="757" height="59"></td>
    <td width="43" rowspan="4"><img src="image/layout/rightLine.jpg" width="43" height="839"></td>
    <td width="70" rowspan="5">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" height="42" background="image/layout/topTwo.jpg"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr align="center">
        <td>&nbsp;&nbsp;<a href="index.do">首页</a></td>
        <td><a href="taxis.do">销售排行</a></td>
        <td><a href="new_merchandise.do">新品上架</a></td>
        <td><a href="special_offer.do">特价商品</a></td>
        <td><a href="see_order_for_goods.do">查看订单</a></td>
        <td><a href="shopping_cart.do">购&nbsp;物&nbsp;车</a></td>
        <td><a href="update_data.do">修改资料</a> </td>
        <td><a href="#" onclick="this.style.behavior='url(#default#homepage)';this.sethomepage('http://www.mingrisoft.com')" >设为首页</a></td>
      </tr>
    </table></td>
  </tr>

  <form action="searchMerchandise.do" name="search" onsubmit="return checkEmptySearch(search)">
  <tr>
    <td colspan="2" height="31" background="image/layout/topThree.jpg"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
        <%
        mrgf.other.SpecialMethod sm=new mrgf.other.SpecialMethod();
        String username=(String)session.getAttribute("username");
        String land="not";
        if(username==null){
          username="欢迎您登录本站,今天是 "+sm.getDateWithString()+"!!!";
        }else{
          username=username+":您好,今天是 "+sm.getDateWithString()+"!!!";
          land="yes";
        }
        %>
        <td><span class="word_deepgrey"><%=username %></span></td>
        <td><span class="word_deepgrey">搜索商品名称:</span><input type="text" name="searchMerchandiseName" style="color:purple"></td>
        <td><input type="image" name="search" src="image/layout/button.gif"></td>
      </tr>
    </table></td>
  </tr>
  </form>

  <tr>
    <td><table width="194"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="191" background="image/layout/land.jpg"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr height="20">
            <td width="12%"></td>
            <td width="32%"></td>
            <td width="56%"></td>
          </tr>
          <tr height="20" align="center">
          <%
          String landClueOn="";
          if(request.getAttribute("landClueOn")!=null){
            landClueOn=request.getAttribute("landClueOn").toString();
          }
          %>
            <td colspan="3"><font color="red"><%=landClueOn %></font></td>
          </tr>

  <form action="land.do" method="POST" name="land" onsubmit="return checkEmptyLand(land)">
          <tr>
            <td>&nbsp;</td>
            <td colspan="2">名称:<input type="text" <%if(land.equals("yes")){ %>readonly="readonly"<%} %> name="username" size="16" style="color:purple"></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td colspan="2">密码:<input type="password" <%if(land.equals("yes")){ %>readonly="readonly"<%} %> name="password" size="16" style="color:purple"></td>
          </tr>
          <tr>
            <td colspan="3"><!--记录用户请求登录时所在的页--><input type="hidden" name="pageInLand" value="<%=request.getServletPath() %>" /></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <%
            if(land.equals("yes")){
            %>
            <td valign="bottom"><a href="exitLand.do" class="style2">退出登录</a></td>
            <%
            }else{
            %>
            <td>&nbsp;</td>
            <%
            }
            %>
            <td><input type="reset" name="Submit" value="重置">&nbsp;
			<input type="submit" name="Submit2" value="登录"></td>
          </tr>
  </form>

          <tr>
            <td colspan="3">&nbsp;</td>
          </tr>
          <%
          if(!land.equals("yes")){
          %>
          <tr align="center">
            <td  colspan="3"><a href="login.do" class="style2">我要注册</a>&nbsp;&nbsp;
			<a href="#" class="style2" onClick="controlAlign()">找回密码</a></td>
          </tr>
          <%
          }else{
          %>
          <tr align="center">
            <td  colspan="3">我要注册&nbsp;&nbsp;找回密码</td>
          </tr>
          <%
          }
          %>
          <tr>
            <td colspan="3">&nbsp;</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="217" background="image/layout/affiche.jpg"><table width="96%" border="0" cellspacing="0" cellpadding="0">
          <tr height="30">
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><marquee height="187" direction="up" scrollamount="1" onmouseout="this.start()" onmouseover="this.stop()">
            <table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <%
              //加载公告
              List affiches=null;
              if(session.getAttribute("affiches")==null){
                String hql="from Affiche";
                affiches=hn.query(hql);
                session.setAttribute("affiches",affiches);
              }else{
                affiches=(List)session.getAttribute("affiches");
              }
              for(int i=0;i<affiches.size();i++){
                Affiche affiche=(Affiche)affiches.get(i);
              %>
              <tr>
                <td width="6%">&nbsp;</td>
                <td width="88%">
                  <a href="#" class="style2" onClick="controlAfficheAlign(<%=affiche.getId() %>)"><%=affiche.getTitle()+"&nbsp;"+affiche.getDates() %></a></td>
                <td width="6%">&nbsp;</td></tr>
              <tr>
                <td colspan="3">&nbsp;</td>
              </tr>
              <%
              }
              %>
            </table>
			</marquee>
			</td>
          </tr>
        </table></td>
      </tr>
      <%
      //搜索销售排行信息
      String hql="";
      hql="from MerchandiseSort where photo = '0'";
      List sonSortsl=(List)hn.query(hql);
      List sellFirstOfEverySort = new ArrayList();
      for(int i=0;i<sonSortsl.size();i++){
        MerchandiseSort sonSort=(MerchandiseSort)sonSortsl.get(i);
        String sql = "select merchandise_id from (select * from tb_sell_info where merchandise_id in (select id from tb_merchandise_info where sort_id=" + sonSort.getId() + ")) sortMerchandise group by sortMerchandise.merchandise_id order by sum(amount) desc";
        List idTaxis = hn.queryWithSql(sql);
        if(idTaxis.size()>0){
          String sid = idTaxis.get(0).toString();
          int id = Integer.parseInt(sid);
          hql = "from MerchandiseInfo where id=" + id;
          MerchandiseInfo info = (MerchandiseInfo) hn.queryOne(hql);
          sellFirstOfEverySort.add(info);
        }
      }
      %>
      <tr>
        <td height="299" background="image/layout/compositor.jpg" valign="top">
    <table width="96%"  border="0" cellspacing="0" cellpadding="0">
      <tr height="30">
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><marquee height="266" direction="up" scrollamount="1" onmouseout="this.start()" onmouseover="this.stop()">
		<table width="100%"  border="0" cellspacing="0" cellpadding="4">
        <%
        for(int i=0;i<sellFirstOfEverySort.size();i++){
          MerchandiseInfo info=(MerchandiseInfo)sellFirstOfEverySort.get(i);
        %>
          <tr>
            <td></td>
            <td><a href="merchandise_info.do?merchandiseId=<%=info.getId() %>" class="style2"><%=info.getName()+"&nbsp;&nbsp;RMB:"+info.getPrice() %></a></td>
          </tr>
        <%
        }
        %>
        </table>
		</marquee></td>
      </tr>
    </table></td>
  </tr>
    </table></td>
    <td width="563" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="65" valign="top" background="image/layout/topFour.jpg"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			  <tr>
			    <td colspan="40" height="8"></td>
			  </tr>
              <tr align="center" height="29">
              <%
              //加载商品类别
              hql="from MerchandiseSort where photo<>'0'";
              List fatherSorts=hn.query(hql);
              session.setAttribute("fatherSorts",fatherSorts);
              //遍例父类
              MerchandiseSort fatherSort=null;
              fatherSort=(MerchandiseSort)fatherSorts.get(0);
              %>
                <td rowspan="3"><a href="fatherSort.do?fatherId=<%=fatherSort.getId() %>&requestPage=<%=request.getServletPath() %>"><img src="image/layout/type/<%=fatherSort.getPhoto() %>" width="23" height="21"></a></td>
                <td><a href="fatherSort.do?fatherId=<%=fatherSort.getId() %>&requestPage=<%=request.getServletPath() %>" class="style2"><%=fatherSort.getName() %></a></td>
              <%
              for(int i=1;i<fatherSorts.size();i++){
                fatherSort=(MerchandiseSort)fatherSorts.get(i);
              %>
                <td rowspan="3"><img src="image/layout/type/oneLine.jpg"></td>
                <td rowspan="3"><a href="fatherSort.do?fatherId=<%=fatherSort.getId() %>&requestPage=<%=request.getServletPath() %>"><img src="image/layout/type/<%=fatherSort.getPhoto() %>" width="23" height="21"></a></td>
                <td><a href="fatherSort.do?fatherId=<%=fatherSort.getId() %>&requestPage=<%=request.getServletPath() %>" class="style2"><%=fatherSort.getName() %></a></td>
              <%
              }
              %>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			  <tr>
			    <td colspan="40" height="1"></td>
			  </tr>
              <tr align="center">
              <%
              //遍例子类
              Set sonSorts=null;
              if(request.getAttribute("sonSorts")==null){
                sonSorts=((MerchandiseSort)fatherSorts.get(0)).getSonSorts();
                session.setAttribute("sonSorts",sonSorts);
              }else if(request.getAttribute("sonSorts")!=null&&request.getAttribute("sonSorts").equals("session")){
                sonSorts=(Set)session.getAttribute("sonSorts");
              }else{
                sonSorts=(Set)request.getAttribute("sonSorts");
                session.setAttribute("sonSorts",sonSorts);
              }
              Iterator it=sonSorts.iterator();
              MerchandiseSort sonSort=null;
              while(it.hasNext()){
                sonSort=(MerchandiseSort)it.next();
              %>
                <td><a href="sonSort.do?fatherId=<%=sonSort.getId() %>&requestPage=<%=request.getServletPath() %>" class="style2"><%=sonSort.getName() %></a></td>
              <%
                while(it.hasNext()){
              %>
                <td><img src="image/layout/type/twoLine.jpg"></td>
                <%
                  break;
                }
              }
              %>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td valign="top">
		<!--内容开始-->
		<tiles:insert attribute="content"/>
		<!--内容结束-->
        </td>
      </tr>
    </table>
	</td>
  </tr>
  <tr valign="bottom">
    <td colspan="3" width="800" height="101" background="image/layout/bottom.jpg">
	<a href="#" onClick="controlLandAlign()">登录</a></td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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