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

📄 main.jsp

📁 网上书店 源代码和数据库网上书店 源代码和数据库
💻 JSP
字号:
<%@ page language="java" import="java.util.*,com.shop.vo.addbook.*" contentType="text/html; charset=GB2312"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>

<html>
  <head>
  <script type="text/javascript">
  
  function showDlg(isbn){
           var  showx = event.screenX - event.offsetX; // + deltaX;
	       var  showy = event.screenY - event.offsetY+40; // + deltaY;
           
           var val= window.showModalDialog("<%=request.getContextPath() %>/js/dateForm.jsp", "", "dialogWidth:170px; dialogHeight:130px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
          
           location.href="<%=request.getContextPath() %>/servlet/CatListServlet?id="+isbn+"&buyCount="+val;
  
  
  }
  
  </script>
    

  </head>
  
  <body background="${pageContext.request.contextPath }/image/leftbg.jpg">
  <form action="${pageContext.request.contextPath }/servlet/AddBookServlet?method=showlist" method="get">
 <%
      List<BookInfoVo> bookList=(List<BookInfoVo>)request.getAttribute("bookList");
      for(Iterator it=bookList.iterator();it.hasNext();){
           BookInfoVo book=(BookInfoVo)it.next();
           String srcStr="";
           String srcStr2="";
           if(book.getBookImage()==null){
              srcStr="/image/toplogo1.gif";
           }else{
              srcStr="/servlet/AddBookServlet?isbn="+book.getIsbn()+"&method=showImg";
            
           }
           BookInfoVo book2;
           	if(it.hasNext()){
              book2=(BookInfoVo)it.next();
              if(book2.getBookImage()==null){
                srcStr2="/image/toplogo1.gif";
              }else{
                 srcStr2="/servlet/AddBookServlet?isbn="+book2.getIsbn()+"&method=showImg";
              }
   %>
  <table width="80%" border="1" align="CENTER" 	bgcolor="#AABBFF">
   
  
    <tr>
      <td width="25%" rowspan="4" align="center"><img width="170" height="200" src="${pageContext.request.contextPath }<%=srcStr %>" ></td>
      <td width="25%" height="30">ISBN:<%=book.getIsbn() %></td>
      <td width="25%" rowspan="4" align="center"><img  width="170" height="200" src="${pageContext.request.contextPath }<%=srcStr2 %>" ></td>
      <td width="25%">ISBN:<%=book2.getIsbn() %></td>
    </tr>
    <tr>
      <td height="30">书名:<%=book.getBookName() %></td>
      <td>书名:<%=book2.getBookName() %></td> 
    </tr>
    <tr>
      <td height="30">作者:<%=book.getAuthor() %></td>
      <td>作者:<%=book2.getAuthor() %></td>
    </tr>
    <tr>
      <td height="30">价格:<%=book.getSellPrice() %></td>
      <td>价格:<%=book2.getSellPrice() %></td>
    </tr>
    <tr align="center">
      <td height="24">&nbsp; <input type="button" value="查看详情" onclick="location.href='${pageContext.request.contextPath }/servlet/AddBookServlet?method=showBookByIsbn&isbn=<%=book.getIsbn() %>'"> </td>
      <td height="30">&nbsp;<input type="button" value="购&nbsp;&nbsp;买" onclick="showDlg(<%=book.getIsbn() %>);"></td>
      <td>&nbsp;<input type="button" value="查看详情"  onclick="location.href='${pageContext.request.contextPath }/servlet/AddBookServlet?method=showBookByIsbn&isbn=<%=book2.getIsbn() %>'"></td>
      <td>&nbsp;<input type="button" value="购&nbsp;&nbsp;买" onclick="showDlg(<%=book2.getIsbn() %>);"></td>
    </tr>
  
  
   
  
  </table>
 <%
    }else{
 
  %>
  
  
  <table width="40%" border="1" align="center" 	bgcolor="#AABBFF">
   
  
    <tr>
      <td width="25%" rowspan="4" align="center"><img width="170" height="200" src="${pageContext.request.contextPath }<%=srcStr %>" ></td>
      <td width="25%" height="30">ISBN:<%=book.getIsbn() %></td>
      
    </tr>
    <tr>
      <td height="30">书名:<%=book.getBookName() %></td>
      
    </tr>
    <tr>
      <td height="30">作者:<%=book.getAuthor() %></td>
      
    </tr>
    <tr>
      <td height="30">价格:<%=book.getSellPrice() %></td>
     
    </tr>
    <tr align="center">
      <td height="24">&nbsp; <input type="button" value="查看详情" onclick="location.href='${pageContext.request.contextPath }/servlet/AddBookServlet?method=showBookByIsbn&isbn=<%=book.getIsbn() %>'"> </td>
      <td height="30">&nbsp;<input type="button" value="购&nbsp;&nbsp;买" onclick="showDlg(<%=book.getIsbn() %>);"></td>
     
    </tr>
  </table>
   <%
   }
    }
   %>
    </form>
    
    <%
     
      if(bookList.size()!=0){
     
     %>
    <table align="center" width="80%"><tr><td align="right"> <jsp:include page="/common/page.jsp"/></td></tr></table>
    <%
    
    }else{
     %>
      <table align="center" width="80%"><tr><td align="center">暂无图书记录!!</td></tr></table>
      <%
      }
       %>
  </body>
  
</html>

⌨️ 快捷键说明

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