├── README.md~ ├── .gitignore ├── .settings ├── org.eclipse.wst.jsdt.ui.superType.name ├── org.eclipse.wst.jsdt.ui.superType.container ├── org.eclipse.jdt.core.prefs ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.wst.common.component └── .jsdtscope ├── WebRoot ├── META-INF │ └── MANIFEST.MF ├── zyl.js ├── focus.swf ├── css │ ├── header.css │ ├── login.css │ ├── myaccount.css │ ├── register.css │ ├── footer.css │ ├── about.css │ ├── books.css │ ├── feedback.css │ ├── index.css │ ├── cart.css │ ├── special.css │ ├── details.css │ ├── contact.css │ └── content.css ├── images │ ├── de.gif │ ├── fr.gif │ ├── gb.gif │ ├── about.gif │ ├── banner.gif │ ├── blank.gif │ ├── border.gif │ ├── cart.gif │ ├── close.gif │ ├── color1.gif │ ├── color2.gif │ ├── color3.gif │ ├── flag.gif │ ├── header.jpg │ ├── logo.gif │ ├── next.gif │ ├── prev.gif │ ├── zoom.gif │ ├── big_pic.jpg │ ├── box_top.gif │ ├── bullet1.gif │ ├── bullet2.gif │ ├── bullet3.gif │ ├── bullet4.gif │ ├── bullet5.gif │ ├── bullet6.gif │ ├── chaozhi.png │ ├── csscreme.gif │ ├── loading.gif │ ├── new_icon.gif │ ├── addtocart.png │ ├── banner │ │ ├── 01.jpg │ │ ├── 02.jpg │ │ ├── 03.jpg │ │ ├── 04.jpg │ │ ├── 05.jpg │ │ ├── 06.jpg │ │ ├── 07.jpg │ │ ├── 08.jpg │ │ ├── 09.jpg │ │ └── 10.jpg │ ├── bookshelf.jpg │ ├── bookstore.png │ ├── box_bottom.gif │ ├── box_center.gif │ ├── cart_thumb.gif │ ├── center_bg.gif │ ├── closelabel.gif │ ├── contact_bt.gif │ ├── footer_bg.gif │ ├── footer_logo.gif │ ├── nextlabel.gif │ ├── order_now.gif │ ├── prevlabel.gif │ ├── promo_icon.gif │ ├── register_bt.gif │ ├── new_prod_box.gif │ ├── special_icon.gif │ └── left_menu_bullet.gif ├── WEB-INF │ ├── lib │ │ └── mysql-connector-java-5.1.27-bin.jar │ └── web.xml ├── footer.jsp ├── index.jsp ├── feedback.jsp ├── about.jsp ├── head.jsp ├── special.jsp ├── details.jsp ├── protocal.html ├── contact.jsp ├── content-right.jsp ├── content-left.jsp ├── register.jsp ├── cart.jsp ├── books.jsp └── myaccount.jsp ├── README.md ├── src └── net │ └── vicp │ └── zyl_me │ ├── model │ ├── CartHandler.java │ ├── DBConnection.java │ ├── FeedBackBean.java │ ├── GoodsBean.java │ ├── UserBean.java │ ├── FeedBackHandler.java │ ├── UserBeanHandler.java │ └── GoodsBeanHandler.java │ └── control │ ├── CartServlet.java │ ├── ShowGoodsServlet.java │ ├── GetIndexGoodsServlet.java │ ├── ShowDetailServlet.java │ ├── LoginServlet.java │ ├── RegisterServlet.java │ └── FeedBackServlet.java ├── .classpath ├── .project └── bookstore.sql /README.md~: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /WebRoot/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /WebRoot/zyl.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/zyl.js -------------------------------------------------------------------------------- /WebRoot/focus.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/focus.swf -------------------------------------------------------------------------------- /WebRoot/css/header.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/css/header.css -------------------------------------------------------------------------------- /WebRoot/css/login.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/css/login.css -------------------------------------------------------------------------------- /WebRoot/images/de.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/de.gif -------------------------------------------------------------------------------- /WebRoot/images/fr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/fr.gif -------------------------------------------------------------------------------- /WebRoot/images/gb.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/gb.gif -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /WebRoot/css/myaccount.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/css/myaccount.css -------------------------------------------------------------------------------- /WebRoot/css/register.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/css/register.css -------------------------------------------------------------------------------- /WebRoot/images/about.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/about.gif -------------------------------------------------------------------------------- /WebRoot/images/banner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/banner.gif -------------------------------------------------------------------------------- /WebRoot/images/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/blank.gif -------------------------------------------------------------------------------- /WebRoot/images/border.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/border.gif -------------------------------------------------------------------------------- /WebRoot/images/cart.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/cart.gif -------------------------------------------------------------------------------- /WebRoot/images/close.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/close.gif -------------------------------------------------------------------------------- /WebRoot/images/color1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/color1.gif -------------------------------------------------------------------------------- /WebRoot/images/color2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/color2.gif -------------------------------------------------------------------------------- /WebRoot/images/color3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/color3.gif -------------------------------------------------------------------------------- /WebRoot/images/flag.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/flag.gif -------------------------------------------------------------------------------- /WebRoot/images/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/header.jpg -------------------------------------------------------------------------------- /WebRoot/images/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/logo.gif -------------------------------------------------------------------------------- /WebRoot/images/next.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/next.gif -------------------------------------------------------------------------------- /WebRoot/images/prev.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/prev.gif -------------------------------------------------------------------------------- /WebRoot/images/zoom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/zoom.gif -------------------------------------------------------------------------------- /WebRoot/images/big_pic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/big_pic.jpg -------------------------------------------------------------------------------- /WebRoot/images/box_top.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/box_top.gif -------------------------------------------------------------------------------- /WebRoot/images/bullet1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/bullet1.gif -------------------------------------------------------------------------------- /WebRoot/images/bullet2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/bullet2.gif -------------------------------------------------------------------------------- /WebRoot/images/bullet3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/bullet3.gif -------------------------------------------------------------------------------- /WebRoot/images/bullet4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/bullet4.gif -------------------------------------------------------------------------------- /WebRoot/images/bullet5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/bullet5.gif -------------------------------------------------------------------------------- /WebRoot/images/bullet6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/bullet6.gif -------------------------------------------------------------------------------- /WebRoot/images/chaozhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/chaozhi.png -------------------------------------------------------------------------------- /WebRoot/images/csscreme.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/csscreme.gif -------------------------------------------------------------------------------- /WebRoot/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/loading.gif -------------------------------------------------------------------------------- /WebRoot/images/new_icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/new_icon.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

书店项目

2 |
3 | 使用技术:JSP、Servlet
4 | 数据库:MySQL 5.0(127.0.0.1:3306,root,)
5 | -------------------------------------------------------------------------------- /WebRoot/images/addtocart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/addtocart.png -------------------------------------------------------------------------------- /WebRoot/images/banner/01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/banner/01.jpg -------------------------------------------------------------------------------- /WebRoot/images/banner/02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/banner/02.jpg -------------------------------------------------------------------------------- /WebRoot/images/banner/03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/banner/03.jpg -------------------------------------------------------------------------------- /WebRoot/images/banner/04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/banner/04.jpg -------------------------------------------------------------------------------- /WebRoot/images/banner/05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/banner/05.jpg -------------------------------------------------------------------------------- /WebRoot/images/banner/06.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/banner/06.jpg -------------------------------------------------------------------------------- /WebRoot/images/banner/07.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/banner/07.jpg -------------------------------------------------------------------------------- /WebRoot/images/banner/08.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/banner/08.jpg -------------------------------------------------------------------------------- /WebRoot/images/banner/09.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/banner/09.jpg -------------------------------------------------------------------------------- /WebRoot/images/banner/10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/banner/10.jpg -------------------------------------------------------------------------------- /WebRoot/images/bookshelf.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/bookshelf.jpg -------------------------------------------------------------------------------- /WebRoot/images/bookstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/bookstore.png -------------------------------------------------------------------------------- /WebRoot/images/box_bottom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/box_bottom.gif -------------------------------------------------------------------------------- /WebRoot/images/box_center.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/box_center.gif -------------------------------------------------------------------------------- /WebRoot/images/cart_thumb.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/cart_thumb.gif -------------------------------------------------------------------------------- /WebRoot/images/center_bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/center_bg.gif -------------------------------------------------------------------------------- /WebRoot/images/closelabel.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/closelabel.gif -------------------------------------------------------------------------------- /WebRoot/images/contact_bt.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/contact_bt.gif -------------------------------------------------------------------------------- /WebRoot/images/footer_bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/footer_bg.gif -------------------------------------------------------------------------------- /WebRoot/images/footer_logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/footer_logo.gif -------------------------------------------------------------------------------- /WebRoot/images/nextlabel.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/nextlabel.gif -------------------------------------------------------------------------------- /WebRoot/images/order_now.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/order_now.gif -------------------------------------------------------------------------------- /WebRoot/images/prevlabel.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/prevlabel.gif -------------------------------------------------------------------------------- /WebRoot/images/promo_icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/promo_icon.gif -------------------------------------------------------------------------------- /WebRoot/images/register_bt.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/register_bt.gif -------------------------------------------------------------------------------- /WebRoot/images/new_prod_box.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/new_prod_box.gif -------------------------------------------------------------------------------- /WebRoot/images/special_icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/special_icon.gif -------------------------------------------------------------------------------- /WebRoot/images/left_menu_bullet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/images/left_menu_bullet.gif -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/model/CartHandler.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/src/net/vicp/zyl_me/model/CartHandler.java -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/control/CartServlet.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/src/net/vicp/zyl_me/control/CartServlet.java -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/mysql-connector-java-5.1.27-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/me10zyl/bookstore/HEAD/WebRoot/WEB-INF/lib/mysql-connector-java-5.1.27-bin.jar -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 4 | org.eclipse.jdt.core.compiler.compliance=1.6 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.6 8 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /WebRoot/footer.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %> 2 | 3 | -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/model/DBConnection.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.model; 2 | 3 | import java.sql.Connection; 4 | import java.sql.DriverManager; 5 | import java.sql.SQLException; 6 | 7 | public class DBConnection { 8 | private Connection connection; 9 | public Connection getConnection() 10 | { 11 | try { 12 | Class.forName("com.mysql.jdbc.Driver"); 13 | connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/bookstore?useUnicode=true&characterEncoding=utf8","root",""); 14 | } catch (ClassNotFoundException e) { 15 | // TODO Auto-generated catch block 16 | e.printStackTrace(); 17 | } catch (SQLException e) { 18 | // TODO Auto-generated catch block 19 | e.printStackTrace(); 20 | } 21 | return connection; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /WebRoot/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /WebRoot/css/footer.css: -------------------------------------------------------------------------------- 1 | #footer 2 | { 3 | margin: 0 auto; 4 | height: 100px; 5 | width: 900px; 6 | border-top: 1px #b2b2b2 dashed; 7 | background: url(../images/footer_bg.gif) no-repeat bottom; 8 | } 9 | .footer-left 10 | { 11 | margin: 10px; 12 | } 13 | .footer-right 14 | { 15 | float: right; 16 | color: #b5b5b6; 17 | font-size: small; 18 | padding: 0; 19 | margin-top: 10px; 20 | margin-left: 10px; 21 | } 22 | .footer-right a 23 | { 24 | text-decoration: none; 25 | } 26 | .footer-right a:link 27 | { 28 | color: #b5b5b6; 29 | font-size: small; 30 | margin-top: 10px; 31 | margin-left: 10px; 32 | } 33 | .footer-right a:hover 34 | { 35 | border-style:dotted; 36 | border-color: orange; 37 | margin-top: 10px; 38 | margin-left: 10px; 39 | } 40 | .footer-right a:visited 41 | { 42 | color: #b5b5b6; 43 | font-size: small; 44 | margin-top: 10px; 45 | margin-left: 10px; 46 | } -------------------------------------------------------------------------------- /WebRoot/feedback.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="net.vicp.zyl_me.model.FeedBackBean"%> 2 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 3 | <% 4 | ArrayList arr = (ArrayList) request.getAttribute("feedbackarr"); 5 | if (arr == null) { 6 | response.sendRedirect("FeedBackServlet"); 7 | return; 8 | } 9 | %> 10 | 11 | 12 | 13 | 14 | 15 |
16 | <% 17 | for (int i = 0; i < arr.size(); i++) { 18 | %> 19 |
20 |
21 |
22 |
23 | <%=arr.get(i).getName()%> 24 | | 25 | <%=arr.get(i).getEmail()%> 26 | | 27 | <%=arr.get(i).getIp()%>
28 |

<%=arr.get(i).getSubject()%>
<%=arr.get(i).getMsg()%>

29 |
30 |
31 |
32 | <% 33 | } 34 | %> 35 |
36 | 37 | -------------------------------------------------------------------------------- /WebRoot/about.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 |
19 |
20 | 关于我们 21 |
22 |
23 | 24 |
25 |
26 |
27 |
书店介绍:
28 |

29 | 这是一个购物狂书店,其为读者打造的建筑之元素、宗教之情结、人文之关怀的书店阅读空间,吸引了众多国内外读者的聚集,使其成为南京重要的文化地标。
30 | 书店是人民集体意志创造的结晶,它铸造的不仅是先锋风格的人文品牌,更是人民的精神品格和思想品质。 31 |

32 |
33 |
34 |
35 |
36 |
37 | “每个以自己的方式想象天堂;从小我设想它作为图书馆。”-Jorge路易斯·博尔赫斯 38 |
39 | 40 |
41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | BookStore 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator 30 | 31 | 32 | 33 | 34 | com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder 35 | 36 | 37 | 38 | 39 | 40 | com.genuitec.eclipse.ast.deploy.core.deploymentnature 41 | org.eclipse.jem.workbench.JavaEMFNature 42 | org.eclipse.wst.common.modulecore.ModuleCoreNature 43 | org.eclipse.wst.common.project.facet.core.nature 44 | org.eclipse.jdt.core.javanature 45 | org.eclipse.wst.jsdt.core.jsNature 46 | 47 | 48 | -------------------------------------------------------------------------------- /WebRoot/css/about.css: -------------------------------------------------------------------------------- 1 | 2 | #content-left qouteblock 3 | { 4 | display:block; 5 | font-size: 10px; 6 | } 7 | #about 8 | { 9 | margin-top: 10px; 10 | display: block; 11 | margin-right: 15px; 12 | } 13 | #about img 14 | { 15 | padding-top: 10px; 16 | float: right; 17 | width: 150px; 18 | height: 150px; 19 | } 20 | #about .item 21 | { 22 | padding: 10px 0 10px 10px; 23 | margin: 10px 30px 20px 0; 24 | display: block; 25 | } 26 | #about .item p 27 | { 28 | padding-left: 20px; 29 | } 30 | #about .item img 31 | { 32 | width: 98px; 33 | height: 150px; 34 | } 35 | #about .item-right 36 | { 37 | width: 295px; 38 | float: left; 39 | padding: 0 0 0 25px; 40 | display: block; 41 | } 42 | #about .box_top 43 | { 44 | width: 295px; 45 | height: 9px; 46 | margin: 0; 47 | padding: 0; 48 | background: url(../images/box_top.gif) no-repeat center bottom; 49 | } 50 | #about .box_center 51 | { 52 | width: 295px; 53 | height: auto; 54 | margin:0; 55 | padding: 0; 56 | background: url(../images/box_center.gif) repeat-y center; 57 | } 58 | #about .box_bottom 59 | { 60 | width: 295px; 61 | height: 9px; 62 | background: url(../images/box_bottom.gif) no-repeat center top; 63 | } 64 | #about .orange 65 | { 66 | color:#f8981d; 67 | font-size: 13px; 68 | padding-left: 15px; 69 | } 70 | #about .orange2 71 | { 72 | color:#f8981d; 73 | font-size: 13px; 74 | padding-left: 15px; 75 | padding-right: 10px; 76 | text-align: right; 77 | } -------------------------------------------------------------------------------- /WebRoot/css/books.css: -------------------------------------------------------------------------------- 1 | #books 2 | { 3 | 4 | display: block; 5 | margin-right: 15px; 6 | } 7 | #books .title a 8 | { 9 | color:red; 10 | text-decoration: underline; 11 | } 12 | #books .book 13 | { 14 | float:left; 15 | margin-right: 25px; 16 | margin-top:30px; 17 | } 18 | #books .book-box 19 | { 20 | width: 132px; 21 | height: 119px; 22 | text-align: center; 23 | vertical-align:middle; 24 | background: url(../images/new_prod_box.gif) no-repeat center; 25 | position: relative; 26 | } 27 | #books .book .new img 28 | { 29 | padding: 0; 30 | width: 50px; 31 | height: 50px; 32 | } 33 | 34 | #books .book img 35 | { 36 | padding-top: 10px; 37 | width: 60px; 38 | height: 100px; 39 | } 40 | .pagination 41 | { 42 | width: 420px; 43 | padding: 5px; 44 | margin: 40px 5px; 45 | text-align: center; 46 | float:left; 47 | clear: both; 48 | font-size: 10px; 49 | } 50 | div.pagination span.disabled { 51 | padding: 2px 5px 2px 5px; 52 | margin-right: 2px; 53 | border: 1px solid #f3f3f3; 54 | color: #ccc; 55 | } 56 | div.pagination span.current { 57 | padding: 2px 5px 2px 5px; 58 | margin-right: 2px; 59 | border: 1px solid #795636; 60 | font-weight: bold; 61 | background-color: #795636; 62 | color: #FFF; 63 | } 64 | .pagination a 65 | { 66 | padding: 2px 5px 2px 5px; 67 | margin-right: 2px; 68 | border: 1px solid #795636; 69 | text-decoration: none; 70 | color: #795636; 71 | } 72 | .pagination .noborder 73 | { 74 | border:0px; 75 | } -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/model/FeedBackBean.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.model; 2 | 3 | public class FeedBackBean { 4 | private long feedid; 5 | private String name; 6 | 7 | private String subject; 8 | 9 | private String msg; 10 | 11 | private String email; 12 | 13 | private String ip; 14 | 15 | 16 | 17 | public FeedBackBean(String name, String subject, String msg, String email, String ip) { 18 | super(); 19 | this.name = name; 20 | this.subject = subject; 21 | this.msg = msg; 22 | this.email = email; 23 | this.ip = ip; 24 | } 25 | 26 | public FeedBackBean(long feedid, String name, String subject, String msg, String email, String ip) { 27 | super(); 28 | this.feedid = feedid; 29 | this.name = name; 30 | this.subject = subject; 31 | this.msg = msg; 32 | this.email = email; 33 | this.ip = ip; 34 | } 35 | 36 | public String getEmail() { 37 | return email; 38 | } 39 | 40 | public long getFeedid() { 41 | return feedid; 42 | } 43 | 44 | public String getIp() { 45 | return ip; 46 | } 47 | 48 | public String getMsg() { 49 | return msg; 50 | } 51 | 52 | public String getName() { 53 | return name; 54 | } 55 | 56 | public String getSubject() { 57 | return subject; 58 | } 59 | 60 | public void setEmail(String email) { 61 | this.email = email; 62 | } 63 | 64 | public void setFeedid(long feedid) { 65 | this.feedid = feedid; 66 | } 67 | 68 | public void setIp(String ip) { 69 | this.ip = ip; 70 | } 71 | 72 | public void setMsg(String msg) { 73 | this.msg = msg; 74 | } 75 | 76 | public void setName(String name) { 77 | this.name = name; 78 | } 79 | 80 | public void setSubject(String subject) { 81 | this.subject = subject; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/control/ShowGoodsServlet.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.control; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.util.ArrayList; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import net.vicp.zyl_me.model.GoodsBean; 13 | import net.vicp.zyl_me.model.GoodsBeanHandler; 14 | 15 | public class ShowGoodsServlet extends HttpServlet { 16 | 17 | /** 18 | * The doGet method of the servlet.
19 | * 20 | * This method is called when a form has its tag value method equals to get. 21 | * 22 | * @param request the request send by the client to the server 23 | * @param response the response send by the server to the client 24 | * @throws ServletException if an error occurred 25 | * @throws IOException if an error occurred 26 | */ 27 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 28 | 29 | String page = request.getParameter("page"); 30 | request.setAttribute("page", page); 31 | request.getRequestDispatcher("books.jsp").forward(request, response); 32 | } 33 | 34 | /** 35 | * The doPost method of the servlet.
36 | * 37 | * This method is called when a form has its tag value method equals to post. 38 | * 39 | * @param request the request send by the client to the server 40 | * @param response the response send by the server to the client 41 | * @throws ServletException if an error occurred 42 | * @throws IOException if an error occurred 43 | */ 44 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 45 | 46 | doGet(request, response); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /WebRoot/css/feedback.css: -------------------------------------------------------------------------------- 1 | #about 2 | { 3 | margin-top: 10px; 4 | display: block; 5 | margin-right: 15px; 6 | } 7 | #feedback .item 8 | { 9 | padding: 10px 0 10px 10px; 10 | margin: 10px 30px 20px 0; 11 | display: block; 12 | } 13 | #feedback .item p 14 | { 15 | padding-left: 20px; 16 | } 17 | #feedback .item img 18 | { 19 | width: 98px; 20 | height: 150px; 21 | } 22 | #feedback .item-right 23 | { 24 | width: 295px; 25 | float: left; 26 | padding: 0 0 0 25px; 27 | display: block; 28 | } 29 | #feedback .box_top 30 | { 31 | width: 295px; 32 | height: 9px; 33 | margin: 0; 34 | padding: 0; 35 | background: url(../images/box_top.gif) no-repeat center bottom; 36 | } 37 | #feedback .box_center 38 | { 39 | width: 295px; 40 | height: auto; 41 | margin:0; 42 | padding: 0; 43 | background: url(../images/box_center.gif) repeat-y center; 44 | } 45 | #feedback .box_bottom 46 | { 47 | width: 295px; 48 | height: 9px; 49 | background: url(../images/box_bottom.gif) no-repeat center top; 50 | } 51 | #feedback .orange 52 | { 53 | color:#f8981d; 54 | font-size: 13px; 55 | padding-left: 15px; 56 | } 57 | #feedback .orange2 58 | { 59 | color:#f8981d; 60 | font-size: 13px; 61 | padding-left: 15px; 62 | padding-right: 10px; 63 | text-align: right; 64 | text-shadow:5px 2px 6px #f8981d; 65 | } 66 | .title 67 | { 68 | padding: 5px 0 5px 0; 69 | color: #b5b5b6; 70 | text-decoration: none; 71 | display: block; 72 | font-size: 13px; 73 | width: 132px; 74 | text-align: center; 75 | } 76 | p.details { 77 | padding: 5px 15px 5px 15px; 78 | font-size: 11px; 79 | } 80 | p { 81 | padding: 5px 0 5px 0; 82 | margin: 0px; 83 | text-align: justify; 84 | line-height: 19px; 85 | display: block; 86 | 87 | -webkit-margin-start: 0px; 88 | -webkit-margin-end: 0px; 89 | } -------------------------------------------------------------------------------- /WebRoot/css/index.css: -------------------------------------------------------------------------------- 1 | 2 | .item 3 | { 4 | float:left; 5 | padding: 10px 0 10px 10px; 6 | margin: 10px 30px 20px 0; 7 | border-bottom: 1px #b2b2b2 dashed; 8 | display: block; 9 | } 10 | .item-left 11 | { 12 | float:left; 13 | display: block; 14 | } 15 | .item img 16 | { 17 | width: 98px; 18 | height: 150px; 19 | } 20 | .item-right 21 | { 22 | width: 295px; 23 | float: left; 24 | padding: 0 0 0 25px; 25 | display: block; 26 | } 27 | .box_top 28 | { 29 | width: 295px; 30 | height: 9px; 31 | margin: 0; 32 | padding: 0; 33 | background: url(../images/box_top.gif) no-repeat center bottom; 34 | } 35 | .box_center 36 | { 37 | width: 295px; 38 | height: auto; 39 | margin:0; 40 | padding: 0; 41 | background: url(../images/box_center.gif) repeat-y center; 42 | } 43 | .box_bottom 44 | { 45 | width: 295px; 46 | height: 9px; 47 | background: url(../images/box_bottom.gif) no-repeat center top; 48 | } 49 | .orange 50 | { 51 | color:#f8981d; 52 | font-size: 13px; 53 | padding-left: 15px; 54 | } 55 | .orange2 56 | { 57 | color:#f8981d; 58 | font-size: 13px; 59 | padding-left: 15px; 60 | padding-right: 10px; 61 | text-align: right; 62 | } 63 | .newbook 64 | { 65 | float:left; 66 | margin-right: 20px; 67 | margin-top:13px; 68 | } 69 | .newbook-box 70 | { 71 | width: 132px; 72 | height: 119px; 73 | text-align: center; 74 | vertical-align:middle; 75 | background: url(../images/new_prod_box.gif) no-repeat center; 76 | position: relative; 77 | } 78 | .newbook .new 79 | { 80 | position: absolute; 81 | top: 0px; 82 | right: 0px; 83 | z-index: 200; 84 | } 85 | .newbook .new img 86 | { 87 | padding: 0; 88 | width: 50px; 89 | height: 50px; 90 | } 91 | 92 | .newbook img 93 | { 94 | padding-top: 10px; 95 | width: 60px; 96 | height: 100px; 97 | } -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/model/GoodsBean.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.model; 2 | 3 | public class GoodsBean { 4 | private long goodsid; 5 | private String goodsname; 6 | private String breifintroduction; 7 | private String detailintroduction; 8 | private float goodsprice; 9 | private String photo; 10 | private String categroy; 11 | 12 | public GoodsBean(long goodsid, String goodsname, String breifintroduction, String detailintroduction, float goodsprice, String photo, String categroy) { 13 | super(); 14 | this.goodsid = goodsid; 15 | this.goodsname = goodsname; 16 | this.breifintroduction = breifintroduction; 17 | this.detailintroduction = detailintroduction; 18 | this.goodsprice = goodsprice; 19 | this.photo = photo; 20 | this.categroy = categroy; 21 | } 22 | public String getBreifintroduction() { 23 | return breifintroduction; 24 | } 25 | public String getCategroy() { 26 | return categroy; 27 | } 28 | public String getDetailintroduction() { 29 | return detailintroduction; 30 | } 31 | public long getGoodsid() { 32 | return goodsid; 33 | } 34 | public String getGoodsname() { 35 | return goodsname; 36 | } 37 | public float getGoodsprice() { 38 | return goodsprice; 39 | } 40 | public String getPhoto() { 41 | return photo; 42 | } 43 | public void setBreifintroduction(String breifintroduction) { 44 | this.breifintroduction = breifintroduction; 45 | } 46 | public void setCategroy(String categroy) { 47 | this.categroy = categroy; 48 | } 49 | public void setDetailintroduction(String detailintroduction) { 50 | this.detailintroduction = detailintroduction; 51 | } 52 | public void setGoodsid(long goodsid) { 53 | this.goodsid = goodsid; 54 | } 55 | public void setGoodsname(String goodsname) { 56 | this.goodsname = goodsname; 57 | } 58 | public void setGoodsprice(float goodsprice) { 59 | this.goodsprice = goodsprice; 60 | } 61 | public void setPhoto(String photo) { 62 | this.photo = photo; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/model/UserBean.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.model; 2 | 3 | public class UserBean { 4 | private long userid; 5 | private String username; 6 | private String password_; 7 | private int grade; 8 | private String truename; 9 | private String email; 10 | private String phone; 11 | private String address_; 12 | 13 | public UserBean(long userid, String username, String password_, int grade, String truename, String email, String phone, String address_) { 14 | super(); 15 | this.userid = userid; 16 | this.username = username; 17 | this.password_ = password_; 18 | this.grade = grade; 19 | this.truename = truename; 20 | this.email = email; 21 | this.phone = phone; 22 | this.address_ = address_; 23 | } 24 | 25 | public String getAddress_() { 26 | return address_; 27 | } 28 | 29 | public String getEmail() { 30 | return email; 31 | } 32 | 33 | public int getGrade() { 34 | return grade; 35 | } 36 | 37 | public String getPassword_() { 38 | return password_; 39 | } 40 | 41 | public String getPhone() { 42 | return phone; 43 | } 44 | 45 | public String getTruename() { 46 | return truename; 47 | } 48 | 49 | public long getUserid() { 50 | return userid; 51 | } 52 | 53 | public String getUsername() { 54 | return username; 55 | } 56 | 57 | public void setAddress_(String address_) { 58 | this.address_ = address_; 59 | } 60 | 61 | public void setEmail(String email) { 62 | this.email = email; 63 | } 64 | 65 | public void setGrade(int grade) { 66 | this.grade = grade; 67 | } 68 | 69 | public void setPassword_(String password_) { 70 | this.password_ = password_; 71 | } 72 | 73 | public void setPhone(String phone) { 74 | this.phone = phone; 75 | } 76 | 77 | public void setTruename(String truename) { 78 | this.truename = truename; 79 | } 80 | 81 | public void setUserid(long userid) { 82 | this.userid = userid; 83 | } 84 | 85 | public void setUsername(String username) { 86 | this.username = username; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /WebRoot/head.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="net.vicp.zyl_me.model.UserBean"%> 2 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 3 | 4 | <% 5 | HttpSession session_ = request.getSession(); 6 | UserBean userBean = (UserBean) session.getAttribute("userBean"); 7 | boolean isLogin = false; 8 | if (userBean != null) { 9 | isLogin = true; 10 | } 11 | String success = request.getParameter("success"); 12 | if(success != null) 13 | { 14 | session_.setAttribute("userBean", null); 15 | isLogin = false; 16 | } 17 | %> 18 | -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/control/GetIndexGoodsServlet.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.control; 2 | 3 | import java.io.IOException; 4 | import java.util.ArrayList; 5 | import java.util.Random; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import net.vicp.zyl_me.model.GoodsBean; 13 | import net.vicp.zyl_me.model.GoodsBeanHandler; 14 | 15 | public class GetIndexGoodsServlet extends HttpServlet { 16 | 17 | /** 18 | * The doGet method of the servlet.
19 | * 20 | * This method is called when a form has its tag value method equals to get. 21 | * 22 | * @param request the request send by the client to the server 23 | * @param response the response send by the server to the client 24 | * @throws ServletException if an error occurred 25 | * @throws IOException if an error occurred 26 | */ 27 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 28 | 29 | GoodsBeanHandler goodsBeanHandler = new GoodsBeanHandler(); 30 | Random ran = new Random(); 31 | ArrayList ranarr = goodsBeanHandler.getRandomGoodsBeans(2); 32 | ArrayList newarr = new ArrayList(); 33 | ArrayList proarr = new ArrayList(); 34 | request.setAttribute("ranarr", ranarr); 35 | request.getRequestDispatcher("index.jsp").forward(request, response); 36 | } 37 | 38 | /** 39 | * The doPost method of the servlet.
40 | * 41 | * This method is called when a form has its tag value method equals to post. 42 | * 43 | * @param request the request send by the client to the server 44 | * @param response the response send by the server to the client 45 | * @throws ServletException if an error occurred 46 | * @throws IOException if an error occurred 47 | */ 48 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 49 | 50 | doGet(request, response); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /WebRoot/special.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="net.vicp.zyl_me.model.GoodsBeanHandler"%> 2 | <%@page import="net.vicp.zyl_me.model.GoodsBean"%> 3 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 4 | <% 5 | String path = request.getContextPath(); 6 | String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; 7 | %> 8 | <% 9 | ArrayList spearr = new GoodsBeanHandler().getSpecialGoodsBean(); 10 | %> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |
23 |
24 |
25 | 特别推荐 26 |
27 | <% 28 | for (int i = 0; i < spearr.size(); i++) { 29 | %> 30 |
31 |
32 | >> 33 |
34 |
35 |
36 |
37 |
简介:
38 |

39 | 41 | <%=spearr.get(i).getBreifintroduction()%> 42 |

43 | 46 |
47 |
48 |
49 |
50 | <% 51 | } 52 | %> 53 |
54 |
55 | 56 |
57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/control/ShowDetailServlet.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.control; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.util.ArrayList; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import net.vicp.zyl_me.model.GoodsBean; 13 | import net.vicp.zyl_me.model.GoodsBeanHandler; 14 | 15 | public class ShowDetailServlet extends HttpServlet { 16 | 17 | /** 18 | * The doGet method of the servlet.
19 | * 20 | * This method is called when a form has its tag value method equals to get. 21 | * 22 | * @param request the request send by the client to the server 23 | * @param response the response send by the server to the client 24 | * @throws ServletException if an error occurred 25 | * @throws IOException if an error occurred 26 | */ 27 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 28 | 29 | String id = request.getParameter("id"); 30 | GoodsBeanHandler goodsBeanHandler = new GoodsBeanHandler(); 31 | int _id = 0; 32 | if(id != null) 33 | { 34 | _id = Integer.parseInt(id); 35 | } 36 | if(_id != 0) 37 | { 38 | GoodsBean goodsBean = goodsBeanHandler.getGoodsBean(_id); 39 | request.setAttribute("goodsBean", goodsBean); 40 | request.getRequestDispatcher("details.jsp").forward(request, response); 41 | } 42 | 43 | 44 | } 45 | 46 | /** 47 | * The doPost method of the servlet.
48 | * 49 | * This method is called when a form has its tag value method equals to post. 50 | * 51 | * @param request the request send by the client to the server 52 | * @param response the response send by the server to the client 53 | * @throws ServletException if an error occurred 54 | * @throws IOException if an error occurred 55 | */ 56 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 57 | 58 | doGet(request, response); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /WebRoot/css/cart.css: -------------------------------------------------------------------------------- 1 | #cartcart 2 | { 3 | width: 355px; 4 | float: left; 5 | padding: 25px; 6 | margin: 20px 0 0 1px; 7 | position: relative; 8 | padding: 10px 0 10px 0; 9 | clear: both; 10 | } 11 | #cartcart img 12 | { 13 | width: 29px; 14 | height: 41px; 15 | } 16 | #cartcart .cart_table { 17 | width: 440px; 18 | border: 1px #CCCCCC solid; 19 | text-align: center; 20 | } 21 | #cartcart table { 22 | font-size: small; 23 | display: table; 24 | border-collapse: separate; 25 | border-spacing: 2px; 26 | border-color: gray; 27 | } 28 | #cartcart tbody { 29 | display: table-row-group; 30 | vertical-align: middle; 31 | border-color: inherit; 32 | } 33 | #cartcart tr.cart_title { 34 | background-color: #DFDFDF; 35 | } 36 | #cartcart tr { 37 | display: table-row; 38 | vertical-align: inherit; 39 | border-color: inherit; 40 | } 41 | #cartcart td { 42 | padding: 3px; 43 | } 44 | #cartcart td a 45 | { 46 | margin-left: 6px; 47 | margin-right: 6px; 48 | color: white; 49 | background: black; 50 | width: 10px; 51 | height: 10px; 52 | font-size: 10px; 53 | padding: 1px; 54 | text-decoration: none; 55 | } 56 | #cartcart td, th { 57 | display: table-cell; 58 | vertical-align: inherit; 59 | } 60 | td.cart_total { 61 | text-align: right; 62 | padding: 5px 15px 5px 0; 63 | } 64 | a.continue { 65 | font-size:x-small; 66 | width: 71px; 67 | height: 25px; 68 | display: block; 69 | float: left; 70 | margin: 10px 0 0 0px; 71 | background: url(../images/register_bt.gif) no-repeat center; 72 | text-decoration: none; 73 | text-align: center; 74 | line-height: 25px; 75 | color: #fff; 76 | } 77 | a.checkout { 78 | position: relative; 79 | left: 116px; 80 | font-size:x-small; 81 | width: 71px; 82 | height: 25px; 83 | display: block; 84 | float: right; 85 | margin: 10px 30px 0 10px; 86 | background: url(../images/register_bt.gif) no-repeat center; 87 | text-decoration: none; 88 | text-align: center; 89 | line-height: 25px; 90 | color: #fff; 91 | } -------------------------------------------------------------------------------- /WebRoot/details.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="net.vicp.zyl_me.model.GoodsBean"%> 2 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 3 | <% 4 | String path = request.getContextPath(); 5 | String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; 6 | GoodsBean goodsBean = (GoodsBean) request.getAttribute("goodsBean"); 7 | %> 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |
23 | 主页 >> 所有书籍 24 |
25 |
26 | 27 | <%=goodsBean.getGoodsname()%> 28 |
29 |
30 |
31 | > 33 |
34 |
35 |
36 |
37 |
简介:
38 |

39 | 41 | <%=goodsBean.getBreifintroduction()%> 42 |

43 |
44 |
45 |
46 |
47 |
48 | 详细介绍 49 |
50 | 名称: 51 | <%=goodsBean.getGoodsname() %> 52 |
价格:¥<%=goodsBean.getGoodsprice() %> 53 |
54 |
55 |

<%=goodsBean.getDetailintroduction() %> 56 |

57 |
58 | 59 | 60 | 61 |
62 |
63 | 64 |
65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /WebRoot/protocal.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | 17 |

18 |

    19 |
  • 用户在使用书店服务时,必须遵守中华人民共和国相关法律法规的规定,用户应同意将不会利用本服务进行任何违法或不正当的活动,包括但不限于下列行为∶ 20 |
  • 21 |
  • (1)上载、展示、张贴、传播或以其它方式传送含有下列内容之一的信息: 22 |
  • 23 |
  • 1) 反对宪法所确定的基本原则的; 24 |
  • 25 |
  • 2) 危害国家安全,泄露国家秘密,颠覆国家政权,破坏国家统一的; 26 |
  • 27 |
  • 3) 损害国家荣誉和利益的; 28 |
  • 29 |
  • 4) 煽动民族仇恨、民族歧视、破坏民族团结的; 30 |
  • 31 |
  • 5) 破坏国家宗教政策,宣扬邪教和封建迷信的; 32 |
  • 33 |
  • 6) 散布谣言,扰乱社会秩序,破坏社会稳定的; 34 |
  • 35 |
  • 7) 散布淫秽、色情、赌博、暴力、凶杀、恐怖或者教唆犯罪的; 36 |
  • 37 |
  • 8) 侮辱或者诽谤他人,侵害他人合法权利的; 38 |
  • 39 |
  • 9) 含有虚假、有害、胁迫、侵害他人隐私、骚扰、侵害、中伤、粗俗、猥亵、或其它道德上令人反感的内容; 40 |
  • 41 |
  • 10) 含有中国法律、法规、规章、条例以及任何具有法律效力之规范所限制或禁止的其它内容的; 42 |
  • 43 |
  • (2)不得为任何非法目的而使用网络服务系统; 44 |
  • 45 |
  • (3)不利用书店服务从事以下活动: 46 |
  • 47 |
  • 1)未经允许,进入计算机信息网络或者使用计算机信息网络资源的; 48 |
  • 49 |
  • 2) 未经允许,对计算机信息网络功能进行删除、修改或者增加的; 50 |
  • 51 |
  • 3) 未经允许,对进入计算机信息网络中存储、处理或者传输的数据和应用程序进行删除、修改或者增加的; 52 |
  • 53 |
  • 4) 故意制作、传播计算机病毒等破坏性程序的; 54 |
  • 55 |
  • 5) 其他危害计算机信息网络安全的行为。 56 |
  • 57 |
  •   用户违反本协议或相关的服务条款的规定,导致或产生的任何第三方主张的任何索赔、要求或损失,包括合理的律师费,您同意赔偿书店与合作公司、关联公司,并使之免受损害。对此,书店有权视用户的行为性质,采取包括但不限于删除用户发布信息内容、暂停使用许可、终止服务、限制使用、回收书店帐号、追究法律责任等措施。对恶意注册书店帐号或利用书店帐号进行违法活动、捣乱、骚扰、欺骗、其他用户以及其他违反本协议的行为,书店有权回收其帐号。同时,书店公司会视司法部门的要求,协助调查。 58 |
  • 59 |
  •  用户不得对本服务任何部分或本服务之使用或获得,进行复制、拷贝、出售、转售或用于任何其它商业目的。 60 |
  • 61 |
  •  用户须对自己在使用书店服务过程中的行为承担法律责任。用户承担法律责任的形式包括但不限于:对受到侵害者进行赔偿,以及在书店公司首先承担了因用户行为导致的行政处罚或侵权损害赔偿责任后,用户应给予书店公司等额的赔偿。 62 |
  • 63 |
64 |

65 | 66 | 67 | -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/control/LoginServlet.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.control; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | import javax.servlet.http.HttpSession; 10 | 11 | import net.vicp.zyl_me.model.UserBeanHandler; 12 | 13 | public class LoginServlet extends HttpServlet { 14 | 15 | /** 16 | * The doGet method of the servlet.
17 | * 18 | * This method is called when a form has its tag value method equals to get. 19 | * 20 | * @param request 21 | * the request send by the client to the server 22 | * @param response 23 | * the response send by the server to the client 24 | * @throws ServletException 25 | * if an error occurred 26 | * @throws IOException 27 | * if an error occurred 28 | */ 29 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 30 | 31 | response.setContentType("text/html"); 32 | String username = request.getParameter("username"); 33 | String password = request.getParameter("password"); 34 | 35 | UserBeanHandler userBeanHandler = new UserBeanHandler(); 36 | if(userBeanHandler.checkUser(username, password)) 37 | { 38 | HttpSession session = request.getSession(); 39 | session.setAttribute("userBean", userBeanHandler.getUserByUserName(username)); 40 | request.getRequestDispatcher("myaccount.jsp").forward(request, response); 41 | }else 42 | { 43 | request.getRequestDispatcher("myaccount.jsp?error=usrorpwdwrong").forward(request, response); 44 | } 45 | } 46 | 47 | /** 48 | * The doPost method of the servlet.
49 | * 50 | * This method is called when a form has its tag value method equals to 51 | * post. 52 | * 53 | * @param request 54 | * the request send by the client to the server 55 | * @param response 56 | * the response send by the server to the client 57 | * @throws ServletException 58 | * if an error occurred 59 | * @throws IOException 60 | * if an error occurred 61 | */ 62 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 63 | 64 | doGet(request, response); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | ShowGoods 8 | net.vicp.zyl_me.control.ShowGoodsServlet 9 | 10 | 11 | ShowDetailServlet 12 | net.vicp.zyl_me.control.ShowDetailServlet 13 | 14 | 15 | GetIndexGoodsServlet 16 | net.vicp.zyl_me.control.GetIndexGoodsServlet 17 | 18 | 19 | CartServlet 20 | net.vicp.zyl_me.control.CartServlet 21 | 22 | 23 | LoginServlet 24 | net.vicp.zyl_me.control.LoginServlet 25 | 26 | 27 | RegisterServlet 28 | net.vicp.zyl_me.control.RegisterServlet 29 | 30 | 31 | FeedBackServlet 32 | net.vicp.zyl_me.control.FeedBackServlet 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | ShowGoods 43 | /ShowGoodsServlet 44 | 45 | 46 | ShowDetailServlet 47 | /ShowDetailServlet 48 | 49 | 50 | GetIndexGoodsServlet 51 | /GetIndexGoodsServlet 52 | 53 | 54 | CartServlet 55 | /CartServlet 56 | 57 | 58 | LoginServlet 59 | /LoginServlet 60 | 61 | 62 | RegisterServlet 63 | /RegisterServlet 64 | 65 | 66 | FeedBackServlet 67 | /FeedBackServlet 68 | 69 | 70 | -------------------------------------------------------------------------------- /WebRoot/contact.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme() + "://" 5 | + request.getServerName() + ":" + request.getServerPort() 6 | + path + "/"; 7 | String error = request.getParameter("error"); 8 | %> 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 |
26 |
27 |
28 | 留言板 29 |
30 |
31 |
32 |
33 |
34 |
致辞:
35 |

欢迎给Book 36 | Store留言,如果您有什么意见或建议,我们将根据您的意见认真负责的改进。

37 |
38 |
39 |
40 |
41 |
42 |
43 |
需填满所有框
44 | <% 45 | if ("feedbackaddwrong".equals(error)) { 46 | out.println("留言失败!"); 47 | } 48 | %> 49 |
50 |   51 |
52 |
53 |   54 |
55 |
56 |   57 |
58 |
59 | 60 |
61 |
62 | 63 |
64 |
65 | 66 | 提交 67 |
68 | 69 |
70 | 72 |
73 | 74 |
75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/model/FeedBackHandler.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.model; 2 | 3 | import java.sql.Connection; 4 | import java.sql.ResultSet; 5 | import java.sql.SQLException; 6 | import java.sql.Statement; 7 | import java.util.ArrayList; 8 | 9 | public class FeedBackHandler { 10 | private Connection connection; 11 | private Statement statement; 12 | private ResultSet resultset; 13 | 14 | public ArrayList getFeedBacks() { 15 | ArrayList arr = new ArrayList(); 16 | try { 17 | connection = new DBConnection().getConnection(); 18 | statement = connection.createStatement(); 19 | resultset = statement.executeQuery("select * from feedback order by feedid desc"); 20 | while (resultset.next()) 21 | arr.add(new FeedBackBean(resultset.getLong(1),resultset.getString(2),resultset.getString(3),resultset.getString(4),resultset.getString(5),resultset.getString(6))); 22 | } catch (SQLException e) { 23 | // TODO Auto-generated catch block 24 | e.printStackTrace(); 25 | } finally { 26 | try { 27 | if (connection != null) { 28 | connection.close(); 29 | } 30 | if (statement != null) { 31 | statement.close(); 32 | } 33 | if (resultset != null) { 34 | resultset.close(); 35 | } 36 | } catch (SQLException e) { 37 | // TODO Auto-generated catch block 38 | e.printStackTrace(); 39 | } 40 | } 41 | return arr; 42 | } 43 | public boolean addFeedBack(FeedBackBean fbb) 44 | { 45 | boolean isSuccessed = false; 46 | try { 47 | connection = new DBConnection().getConnection(); 48 | statement = connection.createStatement(); 49 | resultset = statement.executeQuery("select count(*) from feedback"); 50 | int count = 0; 51 | if(resultset.next()) 52 | count = resultset.getInt(1); 53 | statement.execute("insert into feedback values (null,'"+fbb.getName()+"','"+fbb.getSubject()+"','"+fbb.getMsg()+"','"+fbb.getEmail()+"','"+fbb.getIp()+"')"); 54 | resultset = statement.executeQuery("select count(*) from feedback"); 55 | if(resultset.next()) 56 | { 57 | if(resultset.getInt(1) == count + 1) 58 | isSuccessed = true; 59 | } 60 | } catch (SQLException e) { 61 | // TODO Auto-generated catch block 62 | e.printStackTrace(); 63 | } finally { 64 | try { 65 | if (connection != null) { 66 | connection.close(); 67 | } 68 | if (statement != null) { 69 | statement.close(); 70 | } 71 | if (resultset != null) { 72 | resultset.close(); 73 | } 74 | } catch (SQLException e) { 75 | // TODO Auto-generated catch block 76 | e.printStackTrace(); 77 | } 78 | } 79 | return isSuccessed; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/control/RegisterServlet.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.control; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.http.HttpServlet; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | import net.vicp.zyl_me.model.UserBeanHandler; 12 | 13 | public class RegisterServlet extends HttpServlet { 14 | 15 | /** 16 | * The doGet method of the servlet.
17 | * 18 | * This method is called when a form has its tag value method equals to get. 19 | * 20 | * @param request 21 | * the request send by the client to the server 22 | * @param response 23 | * the response send by the server to the client 24 | * @throws ServletException 25 | * if an error occurred 26 | * @throws IOException 27 | * if an error occurred 28 | */ 29 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 30 | 31 | response.setContentType("text/html"); 32 | String username = request.getParameter("username"); 33 | String password = request.getParameter("password"); 34 | String agree_ = request.getParameter("agree"); 35 | boolean agree = false; 36 | if ("true".equals(agree_)) { 37 | agree = true; 38 | } 39 | UserBeanHandler userBeanHandler = new UserBeanHandler(); 40 | if (!agree) 41 | { 42 | request.getRequestDispatcher("register.jsp?error=noagree").forward(request, response); 43 | return ; 44 | } 45 | if (userBeanHandler.isUserNameExist(username)) { 46 | request.getRequestDispatcher("register.jsp?error=usernameexist").forward(request, response); 47 | } else { 48 | if (userBeanHandler.register(username, password)) { 49 | request.getRequestDispatcher("myaccount.jsp?success=userregister&username="+username).forward(request, response); 50 | } else { 51 | request.getRequestDispatcher("register.jsp?error=registererror").forward(request, response); 52 | } 53 | } 54 | } 55 | 56 | /** 57 | * The doPost method of the servlet.
58 | * 59 | * This method is called when a form has its tag value method equals to 60 | * post. 61 | * 62 | * @param request 63 | * the request send by the client to the server 64 | * @param response 65 | * the response send by the server to the client 66 | * @throws ServletException 67 | * if an error occurred 68 | * @throws IOException 69 | * if an error occurred 70 | */ 71 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 72 | 73 | doGet(request, response); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /WebRoot/css/special.css: -------------------------------------------------------------------------------- 1 | .pagination 2 | { 3 | width: 420px; 4 | padding: 5px; 5 | margin: 40px 5px; 6 | text-align: center; 7 | float:left; 8 | clear: both; 9 | font-size: 10px; 10 | } 11 | div.pagination span.disabled { 12 | padding: 2px 5px 2px 5px; 13 | margin-right: 2px; 14 | border: 1px solid #f3f3f3; 15 | color: #ccc; 16 | } 17 | div.pagination span.current { 18 | padding: 2px 5px 2px 5px; 19 | margin-right: 2px; 20 | border: 1px solid #795636; 21 | font-weight: bold; 22 | background-color: #795636; 23 | color: #FFF; 24 | } 25 | .pagination a 26 | { 27 | padding: 2px 5px 2px 5px; 28 | margin-right: 2px; 29 | border: 1px solid #795636; 30 | text-decoration: none; 31 | color: #795636; 32 | } 33 | #special .item 34 | { 35 | float:left; 36 | padding: 10px 0 10px 10px; 37 | margin: 10px 30px 20px 0; 38 | border-bottom: 1px #b2b2b2 dashed; 39 | display: block; 40 | } 41 | 42 | #special .item-left 43 | { 44 | float:left; 45 | display: block; 46 | } 47 | #special .item img 48 | { 49 | width: 98px; 50 | height: 150px; 51 | } 52 | #special .item-right 53 | { 54 | width: 295px; 55 | float: left; 56 | padding: 0 0 0 25px; 57 | display: block; 58 | position: relative; 59 | } 60 | #special .item-right span 61 | { 62 | position: absolute; 63 | top: 0px; 64 | _top: 6px; 65 | right: 2px; 66 | z-index: 250; 67 | } 68 | #special .item-right span img 69 | { 70 | width: 55px; 71 | height: 55px; 72 | } 73 | #special .box_top 74 | { 75 | width: 295px; 76 | height: 9px; 77 | margin: 0; 78 | padding: 0; 79 | background: url(../images/box_top.gif) no-repeat center bottom; 80 | } 81 | #special .box_center 82 | { 83 | width: 295px; 84 | height: auto; 85 | margin:0; 86 | padding: 0; 87 | background: url(../images/box_center.gif) repeat-y center; 88 | } 89 | #special .box_bottom 90 | { 91 | width: 295px; 92 | height: 9px; 93 | background: url(../images/box_bottom.gif) no-repeat center top; 94 | } 95 | #special .orange 96 | { 97 | color:#f8981d; 98 | font-size: 13px; 99 | padding-left: 15px; 100 | } 101 | #special .orange2 102 | { 103 | color:#f8981d; 104 | font-size: 13px; 105 | padding-left: 15px; 106 | padding-right: 10px; 107 | text-align: right; 108 | text-shadow:5px 2px 6px #f8981d; 109 | } 110 | #special #content-left-bottom 111 | { 112 | clear: left; 113 | } 114 | .title 115 | { 116 | padding: 5px 0 5px 0; 117 | color: #b5b5b6; 118 | text-decoration: none; 119 | display: block; 120 | font-size: 13px; 121 | width: 132px; 122 | text-align: center; 123 | } -------------------------------------------------------------------------------- /WebRoot/content-right.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="net.vicp.zyl_me.model.UserBeanHandler"%> 2 | <%@page import="net.vicp.zyl_me.model.CartHandler"%> 3 | <%@page import="net.vicp.zyl_me.model.GoodsBeanHandler"%> 4 | <%@page import="net.vicp.zyl_me.model.GoodsBean"%> 5 | <%@page import="net.vicp.zyl_me.model.UserBean"%> 6 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 7 | <% 8 | ArrayList proarr = new GoodsBeanHandler().getPromotionGoodsBean(); 9 | CartHandler cartHandler = (CartHandler) session.getAttribute("cartHandler"); 10 | ArrayList newuserarr = new UserBeanHandler().getNewUsers(); 11 | // 保持只有一个购物车[CartHandler] 12 | if (cartHandler == null) { 13 | cartHandler = new CartHandler(); 14 | request.getSession().setAttribute("cartHandler", cartHandler); 15 | } 16 | int price_sum = cartHandler.getTotalGoodsPrice(); 17 | int count = cartHandler.getGoodsCount(); 18 | %> 19 |
20 |
21 | 我的购物车 22 |
23 |
24 | <%=count%> 25 | x 物品 | 总共: <%=price_sum%>¥ 26 | 27 |
28 |
29 | 查看购物车 30 |
31 |
32 | 33 |
34 | 37 |
38 | 39 |
40 |
41 |
42 |
43 | 促销: 44 | <% 45 | for (int i = 0; i < proarr.size(); i++) { 46 | %> 47 |
48 |
<%=proarr.get(i).getGoodsname()%>
49 | 55 |
56 | <% 57 | } 58 | %> 59 |
60 |
61 | 95 |
-------------------------------------------------------------------------------- /src/net/vicp/zyl_me/control/FeedBackServlet.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.control; 2 | 3 | import java.io.IOException; 4 | import java.util.ArrayList; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.http.HttpServlet; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | import net.vicp.zyl_me.model.FeedBackBean; 12 | import net.vicp.zyl_me.model.FeedBackHandler; 13 | 14 | public class FeedBackServlet extends HttpServlet { 15 | 16 | /** 17 | * The doGet method of the servlet.
18 | * 19 | * This method is called when a form has its tag value method equals to get. 20 | * 21 | * @param request 22 | * the request send by the client to the server 23 | * @param response 24 | * the response send by the server to the client 25 | * @throws ServletException 26 | * if an error occurred 27 | * @throws IOException 28 | * if an error occurred 29 | */ 30 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 31 | 32 | response.setContentType("text/html;"); 33 | FeedBackHandler feedBackHandler = new FeedBackHandler(); 34 | String add = request.getParameter("add"); 35 | String name = request.getParameter("name"); 36 | String subject = request.getParameter("subject"); 37 | String email = request.getParameter("email"); 38 | String msg = request.getParameter("message"); 39 | String ip = request.getParameter("ip"); 40 | if (add != null) { 41 | if (name == null || subject == null || msg == null || email == null || ip == null || !feedBackHandler.addFeedBack(new FeedBackBean(name, subject, msg, email, ip))) { 42 | String error = "?error=feedbackaddwrong"; 43 | request.getRequestDispatcher("contact.jsp" + error).forward(request, response); 44 | return; 45 | } else { 46 | request.getRequestDispatcher("contact.jsp").forward(request, response); 47 | return; 48 | } 49 | } 50 | ArrayList arr = feedBackHandler.getFeedBacks(); 51 | request.setAttribute("feedbackarr", arr); 52 | request.getRequestDispatcher("feedback.jsp").forward(request, response); 53 | } 54 | 55 | /** 56 | * The doPost method of the servlet.
57 | * 58 | * This method is called when a form has its tag value method equals to 59 | * post. 60 | * 61 | * @param request 62 | * the request send by the client to the server 63 | * @param response 64 | * the response send by the server to the client 65 | * @throws ServletException 66 | * if an error occurred 67 | * @throws IOException 68 | * if an error occurred 69 | */ 70 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 71 | 72 | request.setCharacterEncoding("utf-8"); 73 | doGet(request, response); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /WebRoot/content-left.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="net.vicp.zyl_me.model.GoodsBeanHandler"%> 2 | <%@page import="net.vicp.zyl_me.model.GoodsBean"%> 3 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 4 | <% 5 | /* ArrayList ranarr = (ArrayList)request.getAttribute("ranarr"); 6 | if(ranarr == null || ranarr.size() != 2) 7 | request.getRequestDispatcher("GetIndexGoodsServlet").forward(request, response); */ 8 | GoodsBeanHandler goodsBeanHandler = new GoodsBeanHandler(); 9 | ArrayList ranarr = goodsBeanHandler.getRandomGoodsBeans(2); 10 | GoodsBean goodsBean1 = ranarr.get(0); 11 | GoodsBean goodsBean2 = ranarr.get(1); 12 | ArrayList newarr = goodsBeanHandler.getNewGoodsBean(); 13 | %> 14 |
15 |
16 | 好书一瞥 17 |
18 |
19 | <% 20 | if (goodsBean1 != null && goodsBean2 != null) { 21 | %> 22 |
23 |
24 | > > 26 | 27 |
28 |
29 |
30 |
31 |
简介:
32 |

33 | <%=goodsBean1.getBreifintroduction()%> 34 |

35 | 39 |
40 |
41 |
42 |
43 |
44 |
45 | > > 47 | 48 |
49 |
50 |
51 |
52 |
简介:
53 |

54 | <%=goodsBean2.getBreifintroduction()%> 55 |

56 | 60 |
61 |
62 |
63 |
64 | <% 65 | } 66 | %> 67 |
68 |
69 | 新书推荐 70 |
71 | <% 72 | for (int i = 0; i < newarr.size(); i++) { 73 | %> 74 |
75 |
<%=newarr.get(i).getGoodsname()%>
76 |
77 | > 79 | > 80 | 81 |
82 |
83 | <% 84 | } 85 | %> 86 |
87 |
-------------------------------------------------------------------------------- /WebRoot/register.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; 5 | String error = request.getParameter("error"); 6 | %> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 注册 22 |
23 |
24 |
25 |
26 |
27 |
致辞:
28 |

29 | 欢迎加入Book Store商店,在这里你可以买到很多很多好玩又好看的书。不仅能增加你的知识,还能边看边玩。 30 |

31 |
32 |
33 |
34 |
35 |
36 | <% 37 | if (error != null) { 38 | if (error.equals("usernameexist")) { 39 | out.println("
用户已存在!
"); 40 | }else if(error.equals("registererror")) 41 | { 42 | out.println("
注册失败!
"); 43 | } 44 | else if(error.equals("noagree")) 45 | { 46 | out.println("
必须同意协议!
"); 47 | } 48 | } 49 | %> 50 |
51 |
填写你的信息
52 |
53 |   54 | 55 |
56 |
57 |   58 | 59 |
60 | 61 |
62 | 63 | 64 | 同意协议 65 | 66 |
67 |
68 | 69 |
70 |
71 |
72 |
73 | 74 |
75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /WebRoot/css/details.css: -------------------------------------------------------------------------------- 1 | #detailsdetails .item { 2 | float: left; 3 | padding: 10px 0 10px 10px; 4 | margin: 10px 30px 20px 0; 5 | border-bottom: 1px #b2b2b2 dashed; 6 | display: block; 7 | } 8 | 9 | #detailsdetails .item-left { 10 | float: left; 11 | display: block; 12 | } 13 | 14 | #detailsdetails .item img { 15 | width: 98px; 16 | height: 150px; 17 | } 18 | 19 | #detailsdetails .item-right { 20 | width: 295px; 21 | float: left; 22 | padding: 0 0 0 25px; 23 | display: block; 24 | position: relative; 25 | } 26 | 27 | #detailsdetails .item-right span { 28 | position: absolute; 29 | top: 0px; 30 | right: 2px; 31 | z-index: 250; 32 | } 33 | 34 | #detailsdetails .item-right span img { 35 | width: 55px; 36 | height: 55px; 37 | } 38 | 39 | #detailsdetails .box_top { 40 | width: 295px; 41 | height: 9px; 42 | margin: 0; 43 | padding: 0; 44 | background: url(../images/box_top.gif) no-repeat center bottom; 45 | } 46 | 47 | #detailsdetails .box_center { 48 | width: 295px; 49 | height: auto; 50 | margin: 0; 51 | padding: 0; 52 | background: url(../images/box_center.gif) repeat-y center; 53 | } 54 | 55 | #detailsdetails .box_bottom { 56 | width: 295px; 57 | height: 9px; 58 | background: url(../images/box_bottom.gif) no-repeat center top; 59 | } 60 | 61 | #detailsdetails .orange { 62 | color: #f8981d; 63 | font-size: 13px; 64 | padding-left: 15px; 65 | } 66 | 67 | #detailsdetails .orange2 { 68 | color: #f8981d; 69 | font-size: 13px; 70 | padding-left: 15px; 71 | padding-right: 10px; 72 | text-align: right; 73 | text-shadow: 5px 2px 6px #f8981d; 74 | } 75 | 76 | #detailsdetails #content-left-bottom { 77 | clear: left; 78 | } 79 | 80 | #detailsdetails .title a { 81 | color: red; 82 | text-decoration: underline; 83 | } 84 | 85 | .title { 86 | padding: 5px 0 5px 0; 87 | color: #b5b5b6; 88 | text-decoration: none; 89 | display: block; 90 | font-size: 13px; 91 | width: 132px; 92 | text-align: center; 93 | } 94 | 95 | marquee { 96 | background: url(../images/footer_logo.gif) no-repeat; 97 | margin-left: -5px; 98 | text-shadow: 2px 2px 1px #ccc; 99 | background-origin: border-box; 100 | background-position: left; 101 | color: #900; 102 | } 103 | 104 | fieldset { 105 | width: 459.5px; 106 | font-size: 15px; 107 | border-style: dashed; 108 | font-family: 微软雅黑; 109 | text-decoration: none; 110 | display: block; 111 | } 112 | 113 | fieldset legend { 114 | z-index: 200; 115 | font-family: 宋体; 116 | font-size: 15px; 117 | font-weight: bold; 118 | border-style: dashed; 119 | margin-left: 15px; 120 | } 121 | 122 | fieldset hr { 123 | margin: 20px 40px 15px 15px; 124 | border: dotted; 125 | } 126 | 127 | fieldset p { 128 | padding: 5px 15px 5px 15px; 129 | font-size: 13px; 130 | margin: 0px; 131 | text-align: justify; 132 | line-height: 19px; 133 | } 134 | 135 | .ttt { 136 | margin-left: 15px; 137 | margin-right: 40px; 138 | } 139 | 140 | .ttt span { 141 | background: url(../images/left_menu_bullet.gif) no-repeat; 142 | padding-left: 15px; 143 | background-position: left; 144 | } 145 | 146 | #detailsdetails .addtocart { 147 | margin-top: 30px; 148 | float: right; 149 | margin-right: -5px; 150 | } -------------------------------------------------------------------------------- /WebRoot/css/contact.css: -------------------------------------------------------------------------------- 1 | #contact 2 | { 3 | width: 355px; 4 | float: left; 5 | padding: 25px; 6 | margin: 10px 0 0 15px; 7 | border: 1px #DFD1D2 dashed; 8 | position: relative; 9 | } 10 | #contact .contact_title 11 | { 12 | position: absolute; 13 | top: -11px; 14 | left: 7px; 15 | width: auto; 16 | height: 20px; 17 | background-color: #795636; 18 | text-align: center; 19 | padding: 0 7px 0 7px; 20 | color: #FFFFFF; 21 | font-size: 11px; 22 | line-height: 20px; 23 | z-index: 200; 24 | } 25 | #contact .row1 label,.row2 label 26 | { 27 | color:black; 28 | font-size: 13px; 29 | font-family: 华文细黑; 30 | font-weight: bold; 31 | } 32 | #contact .row3 label,.row4 label 33 | { 34 | color:#900; 35 | font-size: 13px; 36 | font-family: 华文细黑; 37 | font-weight: bold; 38 | } 39 | #contact .row1 input, .row2 input,.row3 input 40 | { 41 | width: 180px; 42 | border-radius: 3px; 43 | } 44 | #contact .row2 input,.row3 input,.row4 45 | { 46 | margin-top: 12px; 47 | } 48 | #contact .row5 textarea 49 | { 50 | width: 253px; 51 | height: 120px; 52 | font-family: Arial, Helvetica, sans-serif; 53 | font-size: 12px; 54 | color: #999999; 55 | margin-top: 10px; 56 | background-color: #fff; 57 | border: 1px #DFDFDF solid; 58 | margin-left: 30px; 59 | } 60 | /*#contact .row3 61 | { 62 | margin-top:8px; 63 | margin-left: 51px; 64 | font-size:12px; 65 | color:#900; 66 | }*/ 67 | #contact .row6 a 68 | { 69 | margin-top: 20px; 70 | margin-right: 72px; 71 | float:right; 72 | color:#900; 73 | width: 53px; 74 | height: 24px; 75 | display: block; 76 | background: url(../images/contact_bt.gif) no-repeat center; 77 | text-decoration: none; 78 | text-align: center; 79 | line-height: 24px; 80 | color: #fff; 81 | } 82 | #contact_top 83 | { 84 | margin-top: 10px; 85 | display: block; 86 | margin-right: 15px; 87 | } 88 | #contact_top img 89 | { 90 | padding-top: 10px; 91 | float: right; 92 | width: 150px; 93 | height: 150px; 94 | } 95 | #contact_top .item 96 | { 97 | padding: 10px 0 10px 10px; 98 | margin: 10px 30px 20px 0; 99 | display: block; 100 | } 101 | #contact_top .item p 102 | { 103 | padding-left: 20px; 104 | } 105 | #contact_top .item img 106 | { 107 | width: 98px; 108 | height: 150px; 109 | } 110 | #contact_top .item-right 111 | { 112 | width: 295px; 113 | float: left; 114 | padding: 0 0 0 25px; 115 | display: block; 116 | } 117 | #contact_top .box_top 118 | { 119 | width: 295px; 120 | height: 9px; 121 | margin: 0; 122 | padding: 0; 123 | background: url(../images/box_top.gif) no-repeat center bottom; 124 | } 125 | #contact_top .box_center 126 | { 127 | width: 295px; 128 | height: auto; 129 | margin:0; 130 | padding: 0; 131 | background: url(../images/box_center.gif) repeat-y center; 132 | } 133 | #contact_top .box_bottom 134 | { 135 | width: 295px; 136 | height: 9px; 137 | background: url(../images/box_bottom.gif) no-repeat center top; 138 | } 139 | #contact_top .orange 140 | { 141 | color:#f8981d; 142 | font-size: 13px; 143 | padding-left: 15px; 144 | } 145 | #contact_top .orange2 146 | { 147 | color:#f8981d; 148 | font-size: 13px; 149 | padding-left: 15px; 150 | padding-right: 10px; 151 | text-align: right; 152 | text-shadow:5px 2px 6px #f8981d; 153 | } 154 | -------------------------------------------------------------------------------- /WebRoot/css/content.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | margin: 0 auto; 4 | } 5 | #content 6 | { 7 | margin: 0 auto; 8 | padding:0; 9 | height: 882px; 10 | width: 900px; 11 | background: url(../images/center_bg.gif); 12 | } 13 | #content-left 14 | { 15 | width: 490px; 16 | height: 694px; 17 | padding: 20px 0 20px 20px; 18 | float: left; 19 | } 20 | #content-left-bottom 21 | { 22 | clear: left; 23 | } 24 | #content-right 25 | { 26 | width: 370px; 27 | height: 882px; 28 | padding: 20px 0 20px 20px; 29 | float: right; 30 | } 31 | #content-right #cart 32 | { 33 | font-size: 13px; 34 | color: #734633; 35 | font-style:bold; 36 | font-family: 微软雅黑; 37 | float: left; 38 | } 39 | #content-right #banner 40 | { 41 | padding: 0; 42 | } 43 | #content-right #total 44 | { 45 | float:left; 46 | margin-top: 8px; 47 | margin-left: 20px; 48 | font-size: 12px; 49 | } 50 | #content-right #view 51 | { 52 | margin-left: 40px; 53 | float:left; 54 | margin-top: 4px; 55 | font-size: 12px; 56 | } 57 | #content-right #bottom 58 | { 59 | font-size: 12px; 60 | margin: 0 auto; 61 | } 62 | #content-right #bottom #left 63 | { 64 | font-size: 12px; 65 | display: block; 66 | float: left; 67 | margin: 0 45px 0 40px; 68 | padding: 0; 69 | } 70 | #content-right #right 71 | { 72 | float:left; 73 | font-size: 12px; 74 | display: block; 75 | } 76 | #content-right table 77 | { 78 | font-size: 12px; 79 | } 80 | #content-right #right table 81 | { 82 | 83 | } 84 | #content-right #right table tr 85 | { 86 | font-size: 12px; 87 | background: url(../images/left_menu_bullet.gif) no-repeat; 88 | background-position:left; 89 | } 90 | .flag td 91 | { 92 | background: url(../images/flag.gif) no-repeat; 93 | background-position:left; 94 | } 95 | #content-right #right table td 96 | { 97 | padding-left: 20px; 98 | margin-left: 20px; 99 | } 100 | #content-right #right table td a:link 101 | { 102 | color:#808080; 103 | text-decoration: none; 104 | } 105 | #content-right #right table td a:visited 106 | { 107 | color:#808080; 108 | text-decoration: none; 109 | } 110 | a 111 | { 112 | text-decoration: none; 113 | } 114 | #content-right a 115 | { 116 | text-decoration: underline; 117 | } 118 | .red 119 | { 120 | color:#990000; 121 | } 122 | .middle 123 | { 124 | margin: 0 auto; 125 | text-align: center; 126 | } 127 | .middle img 128 | { 129 | margin: 15px auto; 130 | } 131 | .gray 132 | { 133 | 134 | color: #734633; 135 | font-style:bold; 136 | font-family: 微软雅黑; 137 | } 138 | #view a:link 139 | { 140 | color: #990000; 141 | } 142 | #view a:visted 143 | { 144 | color:#990000; 145 | } 146 | .title 147 | { 148 | padding: 5px 0 5px 0; 149 | color: #b5b5b6; 150 | text-decoration: none; 151 | display: block; 152 | font-size: 13px; 153 | width: 132px; 154 | text-align: center; 155 | } 156 | p.details { 157 | padding: 5px 15px 5px 15px; 158 | font-size: 11px; 159 | } 160 | p { 161 | padding: 5px 0 5px 0; 162 | margin: 0px; 163 | text-align: justify; 164 | line-height: 19px; 165 | display: block; 166 | 167 | -webkit-margin-start: 0px; 168 | -webkit-margin-end: 0px; 169 | } 170 | .promotebook 171 | { 172 | margin-top:13px; 173 | margin-bottom:30px; 174 | } 175 | .promotebook-box 176 | { 177 | width: 132px; 178 | height: 119px; 179 | text-align: center; 180 | vertical-align:middle; 181 | background: url(../images/new_prod_box.gif) no-repeat center; 182 | position: relative; 183 | } 184 | .promotebook .promote 185 | { 186 | position: absolute; 187 | top: 0px; 188 | right: 0px; 189 | z-index: 200; 190 | } 191 | .promotebook .promote img 192 | { 193 | padding: 0; 194 | width: 50px; 195 | height: 50px; 196 | } 197 | 198 | .promotebook img 199 | { 200 | padding-top: 10px; 201 | width: 60px; 202 | height: 100px; 203 | } -------------------------------------------------------------------------------- /WebRoot/cart.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | import="java.util.*,net.vicp.zyl_me.model.GoodsBean" 3 | pageEncoding="UTF-8"%> 4 | <% 5 | String path = request.getContextPath(); 6 | String basePath = request.getScheme() + "://" 7 | + request.getServerName() + ":" + request.getServerPort() 8 | + path + "/"; 9 | %> 10 | <% 11 | ArrayList cart = (ArrayList)request.getAttribute("cart"); 12 | ArrayList goodsNums = (ArrayList)request.getAttribute("goodsNums"); 13 | int sum = 0; 14 | %> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 66 | 67 | 68 | 69 |
70 |
71 |
72 | 我的购物车 73 |
74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | <% 85 | for (int i = 0; i < cart.size(); i++) { 86 | if(goodsNums.get(i) > 0) 87 | { 88 | %> 89 | 90 | 95 | 96 | 97 | 99 | 100 | 101 | <% 102 | sum += goodsNums.get(i) * cart.get(i).getGoodsprice(); 103 | } 104 | } 105 | %> 106 | 107 | 109 | 110 | 111 | 112 | 114 | 115 | 116 | 117 |
图书封面书名单价数量总价
alt="" 93 | title="" border="0" class="cart_thumb"> 94 | <%=cart.get(i).getGoodsname()%><%=cart.get(i).getGoodsprice()%>¥+ <%=goodsNums.get(i) %> 98 | -<%=goodsNums.get(i) * cart.get(i).getGoodsprice()%>¥
总数量: 108 | <%=cart.size() %> 本
总共: 113 | <%=sum%>¥
118 | < 继续 结算> 120 |
121 |
122 | 123 |
124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /WebRoot/books.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="net.vicp.zyl_me.model.GoodsBean"%> 2 | <%@page import="net.vicp.zyl_me.model.GoodsBeanHandler"%> 3 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 4 | <% 5 | String path = request.getContextPath(); 6 | String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; 7 | %> 8 | <% 9 | GoodsBeanHandler goodsBeanHandler = new GoodsBeanHandler(); 10 | String __page = (String) request.getAttribute("page"); 11 | int _page = 1; 12 | final int _pageSize = 9; 13 | int _pageRow = goodsBeanHandler.getGoodsBeanCount(); 14 | int _pageCount = _pageRow % _pageSize == 0 ? _pageRow / _pageSize : _pageRow / _pageSize + 1; 15 | if (__page != null) { 16 | _page = Integer.parseInt(__page); 17 | } 18 | ArrayList arr = goodsBeanHandler.getGoodsBeanByPage(_page, _pageSize); 19 | %> 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
32 |
33 |
34 | 主页>> 所有书籍 35 |
36 |
37 | 全部书籍 38 |
39 | <% 40 | for (int i = 0; i < arr.size(); i++) { 41 | GoodsBean goodsBean = arr.get(i); 42 | %> 43 |
44 |
<%=goodsBean.getGoodsname()%>
45 |
46 | > > 48 | 49 |
50 |
51 | <% 52 | } 53 | %> 54 | 120 |
121 |
122 | 123 |
124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /WebRoot/myaccount.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | import="java.util.*,net.vicp.zyl_me.model.GoodsBean,net.vicp.zyl_me.model.UserBean,javax.servlet.http.HttpSession" 3 | pageEncoding="UTF-8"%> 4 | <% 5 | String path = request.getContextPath(); 6 | String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; 7 | %> 8 | <% 9 | HttpSession session_ = request.getSession(); 10 | UserBean userBean = (UserBean) session.getAttribute("userBean"); 11 | boolean isLogin = false; 12 | if (userBean != null) { 13 | isLogin = true; 14 | } 15 | String error = request.getParameter("error"); 16 | String success = request.getParameter("success"); 17 | String username = request.getParameter("username"); 18 | if(success != null) 19 | { 20 | session_.setAttribute("userBean", null); 21 | isLogin = false; 22 | } 23 | if("logout".equals(error)) 24 | { 25 | isLogin = false; 26 | session_.setAttribute("userBean", null); 27 | } 28 | %> 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 |
42 |
43 | 我的账户 44 |
45 | <% 46 | if (!isLogin) { 47 | %> 48 |
49 |
50 | <% 51 | if (error != null) { 52 | if (error.equals("usrorpwdwrong")) { 53 | out.println("
用户名或密码错误!
"); 54 | } 55 | } 56 | if(success != null){ 57 | if(success.equals("userregister")) 58 | { 59 | out.println("
注册成功!欢迎加入我们,"+username+",现在登陆吧~
"); 60 | } 61 | } 62 | %> 63 | 64 |
65 |   66 | 67 |
68 |
69 |   70 | 71 |
72 |
73 | 记住我 74 |
75 |
76 | 77 |
78 |
79 |
80 | <% 81 | } else { 82 | %> 83 |
84 |
85 |
86 |
87 | 88 | 89 | 90 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 115 | 116 | 117 | 118 | 119 | 120 |
我的账号: 91 | <%=userBean.getUsername() %> 92 |
真实姓名:<%=userBean.getTruename() %>
电子邮件:<%=userBean.getEmail() %>
电话号码:<%=userBean.getPhone() %>
用户住址:<%=userBean.getAddress_() %>
112 |
我就是传说中的分割线 113 |
114 |
用户级别:RANK 1
121 |
122 |
123 |
124 | 125 |
126 | 127 | <% 128 | } 129 | %> 130 |
131 | 132 |
133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/model/UserBeanHandler.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.model; 2 | 3 | import java.sql.Connection; 4 | import java.sql.ResultSet; 5 | import java.sql.SQLException; 6 | import java.sql.Statement; 7 | import java.util.ArrayList; 8 | 9 | public class UserBeanHandler { 10 | Connection connection; 11 | Statement statement; 12 | ResultSet resultset; 13 | public boolean isUserNameExist(String username) 14 | { 15 | boolean isExist = false; 16 | try { 17 | connection = new DBConnection().getConnection(); 18 | statement = connection.createStatement(); 19 | resultset = statement.executeQuery("select * from users where username='"+username+"' limit 1"); 20 | if(resultset.next()) 21 | { 22 | isExist = true; 23 | } 24 | } catch (SQLException e) { 25 | // TODO Auto-generated catch block 26 | e.printStackTrace(); 27 | } finally { 28 | try { 29 | if (connection != null) { 30 | connection.close(); 31 | } 32 | if (statement != null) { 33 | statement.close(); 34 | } 35 | if (resultset != null) { 36 | resultset.close(); 37 | } 38 | } catch (SQLException e) { 39 | // TODO Auto-generated catch block 40 | e.printStackTrace(); 41 | } 42 | } 43 | return isExist; 44 | } 45 | public boolean register(String username,String pwd) { 46 | boolean isSuccessed = false; 47 | try { 48 | connection = new DBConnection().getConnection(); 49 | statement = connection.createStatement(); 50 | statement.execute("insert into users values (null,'"+username+"','"+pwd+"',null,null,null,null,null)"); 51 | resultset = statement.executeQuery("select * from users where username='"+username+"' and password_='"+pwd+"' limit 1"); 52 | if(resultset.next()) 53 | isSuccessed = true; 54 | } catch (SQLException e) { 55 | // TODO Auto-generated catch block 56 | e.printStackTrace(); 57 | } finally { 58 | try { 59 | if (connection != null) { 60 | connection.close(); 61 | } 62 | if (statement != null) { 63 | statement.close(); 64 | } 65 | if (resultset != null) { 66 | resultset.close(); 67 | } 68 | } catch (SQLException e) { 69 | // TODO Auto-generated catch block 70 | e.printStackTrace(); 71 | } 72 | } 73 | return isSuccessed; 74 | } 75 | 76 | public boolean checkUser(String username,String pwd) { 77 | boolean isMember = false; 78 | try { 79 | connection = new DBConnection().getConnection(); 80 | statement = connection.createStatement(); 81 | resultset = statement.executeQuery("select password_ from users where username='"+username+"' limit 1"); 82 | if(resultset.next()) 83 | { 84 | if(pwd.equals(resultset.getString(1))) 85 | { 86 | isMember = true; 87 | } 88 | 89 | } 90 | } catch (SQLException e) { 91 | // TODO Auto-generated catch block 92 | e.printStackTrace(); 93 | } finally { 94 | try { 95 | if (connection != null) { 96 | connection.close(); 97 | } 98 | if (statement != null) { 99 | statement.close(); 100 | } 101 | if (resultset != null) { 102 | resultset.close(); 103 | } 104 | } catch (SQLException e) { 105 | // TODO Auto-generated catch block 106 | e.printStackTrace(); 107 | } 108 | } 109 | return isMember; 110 | } 111 | public ArrayList getNewUsers() 112 | { 113 | ArrayList arr = new ArrayList(); 114 | try{ 115 | connection = new DBConnection().getConnection(); 116 | statement = connection.createStatement(); 117 | resultset = statement.executeQuery("select * from users order by userid desc limit 12"); 118 | while(resultset.next()) 119 | { 120 | arr.add(new UserBean(resultset.getLong(1), resultset.getString(2), resultset.getString(3), resultset.getInt(4), resultset.getString(5), resultset.getString(6), resultset.getString(7), resultset.getString(8))); 121 | } 122 | }catch (SQLException e) { 123 | // TODO Auto-generated catch block 124 | e.printStackTrace(); 125 | } finally { 126 | try { 127 | if (connection != null) { 128 | connection.close(); 129 | } 130 | if (statement != null) { 131 | statement.close(); 132 | } 133 | if (resultset != null) { 134 | resultset.close(); 135 | } 136 | } catch (SQLException e) { 137 | // TODO Auto-generated catch block 138 | e.printStackTrace(); 139 | } 140 | } 141 | return arr; 142 | } 143 | public UserBean getUserByUserName(String username) 144 | { 145 | UserBean userBean = null; 146 | try { 147 | connection = new DBConnection().getConnection(); 148 | statement = connection.createStatement(); 149 | resultset = statement.executeQuery("select * from users where username='"+username+"' limit 1"); 150 | if(resultset.next()) 151 | { 152 | userBean = new UserBean(resultset.getLong(1), resultset.getString(2), resultset.getString(3), resultset.getInt(4), resultset.getString(5), resultset.getString(6), resultset.getString(7), resultset.getString(8)); 153 | } 154 | } catch (SQLException e) { 155 | // TODO Auto-generated catch block 156 | e.printStackTrace(); 157 | } finally { 158 | try { 159 | if (connection != null) { 160 | connection.close(); 161 | } 162 | if (statement != null) { 163 | statement.close(); 164 | } 165 | if (resultset != null) { 166 | resultset.close(); 167 | } 168 | } catch (SQLException e) { 169 | // TODO Auto-generated catch block 170 | e.printStackTrace(); 171 | } 172 | } 173 | return userBean; 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /bookstore.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 5.6.23, for Win64 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: bookstore 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.3-m13 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!40101 SET NAMES utf8 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `feedback` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `feedback`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!40101 SET character_set_client = utf8 */; 25 | CREATE TABLE `feedback` ( 26 | `feedid` bigint(20) NOT NULL AUTO_INCREMENT, 27 | `name` varchar(100) COLLATE utf8_bin DEFAULT NULL, 28 | `subject` varchar(100) COLLATE utf8_bin DEFAULT NULL, 29 | `msg` varchar(200) COLLATE utf8_bin DEFAULT NULL, 30 | `email` varchar(100) COLLATE utf8_bin DEFAULT NULL, 31 | `ip` varchar(50) COLLATE utf8_bin DEFAULT NULL, 32 | PRIMARY KEY (`feedid`) 33 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 34 | /*!40101 SET character_set_client = @saved_cs_client */; 35 | 36 | -- 37 | -- Dumping data for table `feedback` 38 | -- 39 | 40 | LOCK TABLES `feedback` WRITE; 41 | /*!40000 ALTER TABLE `feedback` DISABLE KEYS */; 42 | INSERT INTO `feedback` VALUES (1,'','测试留言','测试留言','','0:0:0:0:0:0:0:1'),(2,'','测试留言2','测试留言2','','0:0:0:0:0:0:0:1'); 43 | /*!40000 ALTER TABLE `feedback` ENABLE KEYS */; 44 | UNLOCK TABLES; 45 | 46 | -- 47 | -- Table structure for table `goods` 48 | -- 49 | 50 | DROP TABLE IF EXISTS `goods`; 51 | /*!40101 SET @saved_cs_client = @@character_set_client */; 52 | /*!40101 SET character_set_client = utf8 */; 53 | CREATE TABLE `goods` ( 54 | `goodsid` bigint(20) NOT NULL AUTO_INCREMENT, 55 | `goodsname` varchar(100) COLLATE utf8_bin DEFAULT NULL, 56 | `breifintroduction` varchar(200) COLLATE utf8_bin DEFAULT NULL, 57 | `detailintroduction` varchar(500) COLLATE utf8_bin DEFAULT NULL, 58 | `goodsprice` float DEFAULT NULL, 59 | `photo` varchar(100) COLLATE utf8_bin DEFAULT NULL, 60 | `category` varchar(100) COLLATE utf8_bin DEFAULT NULL, 61 | PRIMARY KEY (`goodsid`) 62 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 63 | /*!40101 SET character_set_client = @saved_cs_client */; 64 | 65 | -- 66 | -- Dumping data for table `goods` 67 | -- 68 | 69 | LOCK TABLES `goods` WRITE; 70 | /*!40000 ALTER TABLE `goods` DISABLE KEYS */; 71 | INSERT INTO `goods` VALUES (1,'Java编程思想','本书赢得了全球程序员的广泛赞誉,即使是最晦涩的概念,在Bruce Eckel的文字亲和力和小而直接的编程示例面前也会化解于无形。从Java的基础语法到最高级特性(深入的面向对象概念、多线程、自动项目构建、单元测试和调试等),本书都能逐步指导你轻松掌握。[1] ','从本书获得的各项大奖以及来自世界各地的读者评论中,不难看出这是一本经典之作。本书的作者拥有多年教学经验,对C、C++以及Java语言都有独到、深入的见解,以通俗易懂及小而直接的示例解释了一个个晦涩抽象的概念。本书共22章,包括操作符、控制执行流程、访问权限控制、复用类、多态、接口、通过异常处理错误、字符串、泛型、数组、容器深入研究、JavaI/O系统、枚举类型、并发以及图形化用户界面等内容。这些丰富的内容,包含了Java语言基础语法以及高级特性,适合各个层次的Java程序员阅读,同时也是高等院校讲授面向对象程序设计语言以及Java语言的绝佳教材和参考书。',37,'03.jpg','编程语言'),(2,'Struts2权威指南','《Struts2权威指南:基于WebWork核心的MVC开发》介绍的Struts 2已经完全超出了Struts 1框架原有的高度,Struts 2建立在Struts 1和WebWork两个框架整合的基础之上,因此提供了更多优秀的机制。','虽然Struts 1目前还未被完全淘汰,但Struts 1所表现出来的缺陷已经处处制约着开发者的手脚。在2007年上半年,Struts 2终于在众多开发者期盼中,发布了第一个稳定版本:2.0.6。为了让众多Struts学习、工作者快速掌握Struts 2的开发,笔者精心编著了本书。本书按Struts 2的架构体系,细致地介绍了Struts 2各个知识点。在介绍过程中,笔者依照读者的学习规律,首先介绍基本概念和基本操作,然后对内容进行深入讲解。笔者在介绍Struts 2框架时,既照顾到Struts 2初学者的能力,对每个知识点都给出简单的快速上手的示例;同时也考虑到开发者在日后开发中可能遇到的问题,详细讲解了每个知识点的各种用法,本书覆盖到Struts 2近80%的API。因此,本书完全可以作为Struts 2框架的权威手册,以供开发者在实际开发过程中参考。\n本书最后配备了几个常用场景的实例,通过实例演示了Struts 2框架的用法,希望读者可以通过这几个实例,触类旁通,解决日常开发中的问题。',40,'08.jpg','程序框架'); 72 | /*!40000 ALTER TABLE `goods` ENABLE KEYS */; 73 | UNLOCK TABLES; 74 | 75 | -- 76 | -- Table structure for table `newgoods` 77 | -- 78 | 79 | DROP TABLE IF EXISTS `newgoods`; 80 | /*!40101 SET @saved_cs_client = @@character_set_client */; 81 | /*!40101 SET character_set_client = utf8 */; 82 | CREATE TABLE `newgoods` ( 83 | `goodsid` int(11) NOT NULL, 84 | PRIMARY KEY (`goodsid`) 85 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 86 | /*!40101 SET character_set_client = @saved_cs_client */; 87 | 88 | -- 89 | -- Dumping data for table `newgoods` 90 | -- 91 | 92 | LOCK TABLES `newgoods` WRITE; 93 | /*!40000 ALTER TABLE `newgoods` DISABLE KEYS */; 94 | INSERT INTO `newgoods` VALUES (1),(2); 95 | /*!40000 ALTER TABLE `newgoods` ENABLE KEYS */; 96 | UNLOCK TABLES; 97 | 98 | -- 99 | -- Table structure for table `promotiongoods` 100 | -- 101 | 102 | DROP TABLE IF EXISTS `promotiongoods`; 103 | /*!40101 SET @saved_cs_client = @@character_set_client */; 104 | /*!40101 SET character_set_client = utf8 */; 105 | CREATE TABLE `promotiongoods` ( 106 | `goodsid` int(11) NOT NULL 107 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 108 | /*!40101 SET character_set_client = @saved_cs_client */; 109 | 110 | -- 111 | -- Dumping data for table `promotiongoods` 112 | -- 113 | 114 | LOCK TABLES `promotiongoods` WRITE; 115 | /*!40000 ALTER TABLE `promotiongoods` DISABLE KEYS */; 116 | INSERT INTO `promotiongoods` VALUES (1),(2); 117 | /*!40000 ALTER TABLE `promotiongoods` ENABLE KEYS */; 118 | UNLOCK TABLES; 119 | 120 | -- 121 | -- Table structure for table `specialgoods` 122 | -- 123 | 124 | DROP TABLE IF EXISTS `specialgoods`; 125 | /*!40101 SET @saved_cs_client = @@character_set_client */; 126 | /*!40101 SET character_set_client = utf8 */; 127 | CREATE TABLE `specialgoods` ( 128 | `goodsid` int(11) NOT NULL, 129 | PRIMARY KEY (`goodsid`) 130 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 131 | /*!40101 SET character_set_client = @saved_cs_client */; 132 | 133 | -- 134 | -- Dumping data for table `specialgoods` 135 | -- 136 | 137 | LOCK TABLES `specialgoods` WRITE; 138 | /*!40000 ALTER TABLE `specialgoods` DISABLE KEYS */; 139 | INSERT INTO `specialgoods` VALUES (1),(2); 140 | /*!40000 ALTER TABLE `specialgoods` ENABLE KEYS */; 141 | UNLOCK TABLES; 142 | 143 | -- 144 | -- Table structure for table `users` 145 | -- 146 | 147 | DROP TABLE IF EXISTS `users`; 148 | /*!40101 SET @saved_cs_client = @@character_set_client */; 149 | /*!40101 SET character_set_client = utf8 */; 150 | CREATE TABLE `users` ( 151 | `userid` bigint(20) NOT NULL AUTO_INCREMENT, 152 | `username` varchar(100) COLLATE utf8_bin DEFAULT NULL, 153 | `password_` varchar(100) COLLATE utf8_bin DEFAULT NULL, 154 | `grade` int(11) DEFAULT NULL, 155 | `truename` varchar(100) COLLATE utf8_bin DEFAULT NULL, 156 | `email` varchar(100) COLLATE utf8_bin DEFAULT NULL, 157 | `phone` varchar(100) COLLATE utf8_bin DEFAULT NULL, 158 | `address_` varchar(100) COLLATE utf8_bin DEFAULT NULL, 159 | PRIMARY KEY (`userid`) 160 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 161 | /*!40101 SET character_set_client = @saved_cs_client */; 162 | 163 | -- 164 | -- Dumping data for table `users` 165 | -- 166 | 167 | LOCK TABLES `users` WRITE; 168 | /*!40000 ALTER TABLE `users` DISABLE KEYS */; 169 | INSERT INTO `users` VALUES (1,'611033','123123',NULL,NULL,NULL,NULL,NULL),(2,'611034','123123',NULL,NULL,NULL,NULL,NULL); 170 | /*!40000 ALTER TABLE `users` ENABLE KEYS */; 171 | UNLOCK TABLES; 172 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 173 | 174 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 175 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 176 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 177 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 178 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 179 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 180 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 181 | 182 | -- Dump completed on 2015-05-27 17:19:14 183 | -------------------------------------------------------------------------------- /src/net/vicp/zyl_me/model/GoodsBeanHandler.java: -------------------------------------------------------------------------------- 1 | package net.vicp.zyl_me.model; 2 | 3 | import java.sql.Connection; 4 | import java.sql.ResultSet; 5 | import java.sql.SQLException; 6 | import java.sql.Statement; 7 | import java.util.ArrayList; 8 | import java.util.Random; 9 | 10 | public class GoodsBeanHandler { 11 | Connection connection; 12 | Statement statement; 13 | ResultSet resultset; 14 | 15 | public int getGoodsBeanCount() { 16 | int count = 0; 17 | try { 18 | connection = new DBConnection().getConnection(); 19 | statement = connection.createStatement(); 20 | resultset = statement.executeQuery("select count(*) from goods"); 21 | if (resultset.next()) 22 | count = resultset.getInt(1); 23 | } catch (SQLException e) { 24 | // TODO Auto-generated catch block 25 | e.printStackTrace(); 26 | } finally { 27 | try { 28 | if (connection != null) { 29 | connection.close(); 30 | } 31 | if (statement != null) { 32 | statement.close(); 33 | } 34 | if (resultset != null) { 35 | resultset.close(); 36 | } 37 | } catch (SQLException e) { 38 | // TODO Auto-generated catch block 39 | e.printStackTrace(); 40 | } 41 | } 42 | return count; 43 | } 44 | 45 | public ArrayList getGoodsBeanByPage(int page, int pageSize) { 46 | ArrayList arr = new ArrayList(); 47 | try { 48 | connection = new DBConnection().getConnection(); 49 | statement = connection.createStatement(); 50 | // resultset = 51 | // statement.executeQuery("select * from goods where goodsid limit"+ 52 | // pageSize +"not in (select goodsid from goods limit "+ pageSize * 53 | // (page - 1)+")"); 54 | resultset = statement.executeQuery("select * from goods limit " + pageSize * (page - 1) + "," + pageSize * (page - 1) + pageSize); 55 | while (resultset.next()) 56 | arr.add(new GoodsBean(resultset.getLong(1), resultset.getString(2), resultset.getString(3), resultset.getString(4), resultset.getFloat(5), resultset.getString(6), resultset.getString(7))); 57 | } catch (SQLException e) { 58 | // TODO Auto-generated catch block 59 | e.printStackTrace(); 60 | } finally { 61 | try { 62 | if (connection != null) { 63 | connection.close(); 64 | } 65 | if (statement != null) { 66 | statement.close(); 67 | } 68 | if (resultset != null) { 69 | resultset.close(); 70 | } 71 | } catch (SQLException e) { 72 | // TODO Auto-generated catch block 73 | e.printStackTrace(); 74 | } 75 | } 76 | return arr; 77 | } 78 | 79 | public ArrayList getAllGoodsBean() { 80 | ArrayList arr = new ArrayList(); 81 | try { 82 | connection = new DBConnection().getConnection(); 83 | statement = connection.createStatement(); 84 | resultset = statement.executeQuery("select * from goods"); 85 | while (resultset.next()) 86 | arr.add(new GoodsBean(resultset.getLong(1), resultset.getString(2), resultset.getString(3), resultset.getString(4), resultset.getFloat(5), resultset.getString(6), resultset.getString(7))); 87 | } catch (SQLException e) { 88 | // TODO Auto-generated catch block 89 | e.printStackTrace(); 90 | } finally { 91 | try { 92 | if (connection != null) { 93 | connection.close(); 94 | } 95 | if (statement != null) { 96 | statement.close(); 97 | } 98 | if (resultset != null) { 99 | resultset.close(); 100 | } 101 | } catch (SQLException e) { 102 | // TODO Auto-generated catch block 103 | e.printStackTrace(); 104 | } 105 | } 106 | return arr; 107 | } 108 | 109 | public ArrayList getRandomGoodsBeans(int size) { 110 | ArrayList arr = new ArrayList(); 111 | Random ran = new Random(); 112 | ArrayList nums = new ArrayList(); 113 | int rowCount = getGoodsBeanCount(); 114 | boolean isUsed[] = new boolean[rowCount]; 115 | for (int i = 0; i < size; i++) { 116 | int num = 0; 117 | do { 118 | num = ran.nextInt(rowCount); 119 | } while (isUsed[num] == true); 120 | isUsed[num] = true; 121 | nums.add(num + 1); 122 | } 123 | try { 124 | connection = new DBConnection().getConnection(); 125 | statement = connection.createStatement(); 126 | String sql = "select * from goods where goodsid in ("; 127 | for (int i = 0; i < nums.size() - 1; i++) { 128 | sql += nums.get(i) + ","; 129 | } 130 | sql += nums.get(nums.size() - 1) + ")"; 131 | resultset = statement.executeQuery(sql); 132 | while (resultset.next()) 133 | arr.add(new GoodsBean(resultset.getLong(1), resultset.getString(2), resultset.getString(3), resultset.getString(4), resultset.getFloat(5), resultset.getString(6), resultset.getString(7))); 134 | } catch (SQLException e) { 135 | // TODO Auto-generated catch block 136 | e.printStackTrace(); 137 | } finally { 138 | try { 139 | if (connection != null) { 140 | connection.close(); 141 | } 142 | if (statement != null) { 143 | statement.close(); 144 | } 145 | if (resultset != null) { 146 | resultset.close(); 147 | } 148 | } catch (SQLException e) { 149 | // TODO Auto-generated catch block 150 | e.printStackTrace(); 151 | } 152 | } 153 | return arr; 154 | } 155 | 156 | public ArrayList getNewGoodsBean() { 157 | ArrayList arr = new ArrayList(); 158 | try { 159 | connection = new DBConnection().getConnection(); 160 | statement = connection.createStatement(); 161 | resultset = statement.executeQuery("select * from goods where goodsid in (select goodsid from newgoods)"); 162 | while (resultset.next()) 163 | arr.add(new GoodsBean(resultset.getLong(1), resultset.getString(2), resultset.getString(3), resultset.getString(4), resultset.getFloat(5), resultset.getString(6), resultset.getString(7))); 164 | } catch (SQLException e) { 165 | // TODO Auto-generated catch block 166 | e.printStackTrace(); 167 | } finally { 168 | try { 169 | if (connection != null) { 170 | connection.close(); 171 | } 172 | if (statement != null) { 173 | statement.close(); 174 | } 175 | if (resultset != null) { 176 | resultset.close(); 177 | } 178 | } catch (SQLException e) { 179 | // TODO Auto-generated catch block 180 | e.printStackTrace(); 181 | } 182 | } 183 | return arr; 184 | } 185 | 186 | public ArrayList getSpecialGoodsBean() { 187 | ArrayList arr = new ArrayList(); 188 | try { 189 | connection = new DBConnection().getConnection(); 190 | statement = connection.createStatement(); 191 | resultset = statement.executeQuery("select * from goods where goodsid in (select goodsid from specialgoods)"); 192 | while (resultset.next()) 193 | arr.add(new GoodsBean(resultset.getLong(1), resultset.getString(2), resultset.getString(3), resultset.getString(4), resultset.getFloat(5), resultset.getString(6), resultset.getString(7))); 194 | } catch (SQLException e) { 195 | // TODO Auto-generated catch block 196 | e.printStackTrace(); 197 | } finally { 198 | try { 199 | if (connection != null) { 200 | connection.close(); 201 | } 202 | if (statement != null) { 203 | statement.close(); 204 | } 205 | if (resultset != null) { 206 | resultset.close(); 207 | } 208 | } catch (SQLException e) { 209 | // TODO Auto-generated catch block 210 | e.printStackTrace(); 211 | } 212 | } 213 | return arr; 214 | } 215 | 216 | public ArrayList getPromotionGoodsBean() { 217 | ArrayList arr = new ArrayList(); 218 | try { 219 | connection = new DBConnection().getConnection(); 220 | statement = connection.createStatement(); 221 | resultset = statement.executeQuery("select * from goods where goodsid in (select goodsid from promotiongoods)"); 222 | while (resultset.next()) 223 | arr.add(new GoodsBean(resultset.getLong(1), resultset.getString(2), resultset.getString(3), resultset.getString(4), resultset.getFloat(5), resultset.getString(6), resultset.getString(7))); 224 | } catch (SQLException e) { 225 | // TODO Auto-generated catch block 226 | e.printStackTrace(); 227 | } finally { 228 | try { 229 | if (connection != null) { 230 | connection.close(); 231 | } 232 | if (statement != null) { 233 | statement.close(); 234 | } 235 | if (resultset != null) { 236 | resultset.close(); 237 | } 238 | } catch (SQLException e) { 239 | // TODO Auto-generated catch block 240 | e.printStackTrace(); 241 | } 242 | } 243 | return arr; 244 | } 245 | 246 | public GoodsBean getGoodsBean(int id) { 247 | GoodsBean goodsBean = null; 248 | try { 249 | connection = new DBConnection().getConnection(); 250 | statement = connection.createStatement(); 251 | resultset = statement.executeQuery("select * from goods where goodsid=" + id); 252 | if (resultset.next()) 253 | goodsBean = new GoodsBean(resultset.getLong(1), resultset.getString(2), resultset.getString(3), resultset.getString(4), resultset.getFloat(5), resultset.getString(6), resultset.getString(7)); 254 | } catch (SQLException e) { 255 | // TODO Auto-generated catch block 256 | e.printStackTrace(); 257 | } finally { 258 | try { 259 | if (connection != null) { 260 | connection.close(); 261 | } 262 | if (statement != null) { 263 | statement.close(); 264 | } 265 | if (resultset != null) { 266 | resultset.close(); 267 | } 268 | } catch (SQLException e) { 269 | // TODO Auto-generated catch block 270 | e.printStackTrace(); 271 | } 272 | } 273 | return goodsBean; 274 | } 275 | } 276 | --------------------------------------------------------------------------------