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

📄 bookstore_jsp.java

📁 实现在线书店的基本功能 应用了hibernate+jsp 技术采用了mvc三层设计模式
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      out.write("                <tr>\r\n");
      out.write("                    <td width=\"229\" height=\"91\" valign=\"top\"><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"  class=\"panel\">\r\n");
      out.write("                            <!--DWLayoutTable-->\r\n");
      out.write("                            <tr>\r\n");
      out.write("                              \r\n");
      out.write("                              <td><strong><h3><font color=\"green\">分类浏览</font></h3></strong></td>\r\n");
      out.write("                            </tr>\r\n");
      out.write("                            \r\n");
      out.write("                            ");

            request.setCharacterEncoding("UTF-8");
            String btid = null;
            String btname = null;
            Collection c = bookDB.getBookTypeSet();
            Iterator i = c.iterator();
            while (i.hasNext()) {
                Booktype bt = (Booktype) i.next();
                btid = bt.getId();
                btname = btid + "";
                            
      out.write("\r\n");
      out.write("                            <tr>        \r\n");
      out.write("                                <td bgcolor=\"#ffffaa\">\r\n");
      out.write("                                    <a href=\"");
      out.print(request.getContextPath());
      out.write("/bookstore.jsp?btname=");
      out.print(btname);
      out.write("\" target=\"_self\"><strong>\r\n");
      out.write("                                ");
      out.print(convert(bt.getName()));
      out.write("&nbsp;</strong></a></td>\r\n");
      out.write("                            </tr>    \r\n");
      out.write("                            ");
 }
      out.write("<!--DWLayoutEmptyCell-->&nbsp;\r\n");
      out.write("                            \r\n");
      out.write("                        </table>\r\n");
      out.write("                    </td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                <tr>\r\n");
      out.write("                    <td height=\"165\">&nbsp;</td>\r\n");
      out.write("                </tr>\r\n");
      out.write("        </table>      </td>\r\n");
      out.write("        <td width=\"794\" valign=\"top\"><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
      out.write("            <!--DWLayoutTable-->\r\n");
      out.write("            <tr>\r\n");
      out.write("            <td width=\"53\" height=\"410\">&nbsp;</td>\r\n");
      out.write("            <td width=\"741\" valign=\"top\">");

            // Additions to the shopping cart
            String bookId = request.getParameter("Add");
            if (bookId != null) {
                BookDetails book = bookDB.getBookDetails(bookId);
                cart.add(bookId, book);
                
      out.write("\r\n");
      out.write("                <p>                        \r\n");
      out.write("                <h3>\r\n");
      out.write("                    <font color=\"red\">\r\n");
      out.write("                您已将 <i>");
      out.print(convert(book.getTitle()));
      out.write("</i> 加入购物车</font></h3>\r\n");
      out.write("                ");

            }
            if (cart.getNumberOfItems() > 0) {
                
      out.write("\r\n");
      out.write("                \r\n");
      out.write("                <p><strong><a href=\"");
      out.print(request.getContextPath());
      out.write("/showcart.jsp?user=");
      out.print(session.getAttribute("user"));
      out.write("\" target=\"_self\">察看购物车</a>&nbsp;&nbsp;&nbsp;\r\n");
      out.write("                <a href=\"");
      out.print(request.getContextPath());
      out.write("/cashier.jsp\" target=\"_self\">付账</a></p>\r\n");
      out.write("                </strong>\r\n");
      out.write("                \r\n");
      out.write("                ");

            }
                
      out.write("\r\n");
      out.write("              \r\n");
      out.write("              <h3><font color=\"green\">请选择想购买的书:</font></h3>                <table>\r\n");
      out.write("                  <!--DWLayoutTable-->\r\n");
      out.write("                    ");

            request.setCharacterEncoding("UTF-8");
            btname = request.getParameter("btname");
            if (btname == null) {
                Collection cc=bookDB.getBooks();
                Iterator ii=cc.iterator();
                while(ii.hasNext()){
                    BookDetails book=(BookDetails)ii.next();
                    bookId=book.getBookId();
                    
      out.write("\r\n");
      out.write("\t\t\t\t\t\r\n");
      out.write("                <tr>    \r\n");
      out.write("\t\t\t\t        \r\n");
      out.write("                                       \r\n");
      out.write("\t\t\t\t        <td width=\"244\" height=\"26\" valign=\"top\" bgcolor=\"#ffffaa\">\r\n");
      out.write("                            <a href=\"");
      out.print(request.getContextPath());
      out.write("/bookdetails.jsp?bookId=");
      out.print(bookId);
      out.write("\" target=\"_self\"><strong>\r\n");
      out.write("                        ");
      out.print(convert(book.getTitle()));
      out.write("&nbsp;</strong></a></td>\r\n");
      out.write("                        \r\n");
      out.write("                        \r\n");
      out.write("                  </tr>\r\n");
      out.write("                    <tr>\r\n");
      out.write("                      <td height=\"26\" valign=\"top\" bgcolor=\"#ffffff\">&nbsp;&nbsp;作者:<em>");
      out.print(convert(book.getName()));
      out.write("</em>&nbsp;\r\n");
      out.write("                     \r\n");
      out.write("                    </tr>\r\n");
      out.write("\t\t\t\t\t   <td bgcolor=\"#ffffaa\" rowspan=1>\r\n");
      out.write("                        <a href=\"");
      out.print(request.getContextPath());
      out.write("/bookstore.jsp?Add=");
      out.print(bookId);
      out.write("\" target=\"_self\">&nbsp;加入购物车&nbsp;</a></td>\r\n");
      out.write("            ");
}
            }else{
            Booktype bt = bookDB.getBooktype(btname);
            i = bt.getBookDetails().iterator();
            while (i.hasNext()) {
                
                BookDetails book = (BookDetails) i.next();
                bookId = book.getBookId();
              // javax.swing.JOptionPane.showMessageDialog(null, book.getName());
                    
      out.write("\r\n");
      out.write("                    \r\n");
      out.write("                   <tr>    \r\n");
      out.write("\t\t\t\t        \r\n");
      out.write("                                       \r\n");
      out.write("\t\t\t\t        <td width=\"244\" height=\"26\" valign=\"top\" bgcolor=\"#ffffaa\">\r\n");
      out.write("                            <a href=\"");
      out.print(request.getContextPath());
      out.write("/bookdetails.jsp?bookId=");
      out.print(bookId);
      out.write("\" target=\"_self\"><strong>\r\n");
      out.write("                        ");
      out.print(convert(book.getTitle()));
      out.write("&nbsp;</strong></a></td>\r\n");
      out.write("                        \r\n");
      out.write("                        \r\n");
      out.write("                  </tr>\r\n");
      out.write("                    <tr>\r\n");
      out.write("                      <td height=\"26\" valign=\"top\" bgcolor=\"#ffffff\">&nbsp;&nbsp;作者:<em>");
      out.print(convert(book.getName()));
      out.write("</em>&nbsp;\r\n");
      out.write("                     \r\n");
      out.write("                    </tr>\r\n");
      out.write("\t\t\t\t\t   <td bgcolor=\"#ffffaa\" rowspan=1>\r\n");
      out.write("                        <a href=\"");
      out.print(request.getContextPath());
      out.write("/bookstore.jsp?Add=");
      out.print(bookId);
      out.write("\" target=\"_self\">&nbsp;加入购物车&nbsp;</a></td>\r\n");
      out.write("                    ");
 }}
      out.write("\r\n");
      out.write("              </table></td>\r\n");
      out.write("        </tr>\r\n");
      out.write("    </table>\r\n");
      out.write("</td>\r\n");
      out.write("</tr>\r\n");
      out.write("</table>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

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