您的位置:首页 > 数据库

xiangmu

2014-01-07 16:05 239 查看
com.buaa.dao

 

IOrderDao.java

package com.buaa.dao; import java.sql.SQLException; import java.util.List; import com.buaa.vo.Order; public interface IOrderDao { public void insertOrder(Order order) throws SQLException; public List<Order> queryOrderByUserid(String userid) throws SQLException; public void deleteOrder(String orderid) throws SQLException; } 

 

IOrderDetailDao.java

package com.buaa.dao; import java.sql.SQLException; import java.util.List; import com.buaa.vo.OrderDetail; public interface IOrderDetailDao { public void insertOrderDetail(OrderDetail orderDetail) throws SQLException; public List<OrderDetail> queryDetailByOrderid(String orderid) throws SQLException; public void deleteOrderDetail(String orderid) throws SQLException; } 

 

IProductDao.java

package com.buaa.dao; import java.sql.SQLException; import java.util.List; import com.buaa.vo.Product; public interface IProductDao { public List<Product> pageQueryProduct(int start, int end, String name) throws SQLException; public int getRecordCount(String name) throws SQLException; public Product queryProductById(String id) throws SQLException; }

 

 

IUserDao.java

package com.buaa.dao; import java.sql.SQLException; import com.buaa.vo.User; public interface IUserDao { public void insertUser(User user) throws SQLException; public void updateUser(User user) throws SQLException; public User queryUserByName(String username) throws SQLException; } 

 

 

 

com.buaa.dao.imp

 

OrderDao

package com.buaa.dao.impl; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.buaa.dao.IOrderDao; import com.buaa.util.DBUtil; import com.buaa.vo.Order; public class OrderDao implements IOrderDao { private ResultSet rs = null; private String sql = null; public void deleteOrder(String orderid) throws SQLException { sql = "delete from orders where orderid=?"; List<Object> param = new ArrayList<Object>(); param.add(orderid); DBUtil.update(sql, param); } public void insertOrder(Order order) throws SQLException { sql = "insert into orders values(?,?,?,?,?)"; List<Object> param = new ArrayList<Object>(); param.add(order.getOrderid()); param.add(order.getCost()); param.add(order.getPayType()); param.add(order.getUserid()); param.add(order.getTime()); DBUtil.update(sql, param); } public List<Order> queryOrderByUserid(String userid) throws SQLException { sql = "select * from orders where userid=?"; List<Object> param = new ArrayList<Object>(); List<Order> orderList = new ArrayList<Order>(); param.add(userid); rs = DBUtil.query(sql, param); while(rs.next()) { Order o = new Order(); o.setOrderid(rs.getString("orderid")); o.setCost(rs.getDouble("cost")); o.setPayType(rs.getString("paytype")); o.setUserid(rs.getString("userid")); o.setTime(rs.getTimestamp("time")); orderList.add(o); } return orderList; } }

 

OrderDetailDao

package com.buaa.dao.impl; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.buaa.dao.IOrderDetailDao; import com.buaa.util.DBUtil; import com.buaa.vo.OrderDetail; public class OrderDetailDao implements IOrderDetailDao { private ResultSet rs = null; private String sql = null; public void deleteOrderDetail(String orderid) throws SQLException { sql = "delete from orderdetail where orderid=?"; List<Object> param = new ArrayList<Object>(); param.add(orderid); DBUtil.update(sql, param); } public void insertOrderDetail(OrderDetail orderDetail) throws SQLException { sql = "insert into orderdetail values(?,?,?,?,?,?)"; List<Object> param = new ArrayList<Object>(); param.add(orderDetail.getDetailid()); param.add(orderDetail.getOrderid()); param.add(orderDetail.getProductid()); param.add(orderDetail.getProductname()); param.add(orderDetail.getBaseprice()); param.add(orderDetail.getNum()); DBUtil.update(sql, param); } public List<OrderDetail> queryDetailByOrderid(String orderid) throws SQLException { sql = "select * from orderdetail where orderid=?"; List<Object> param = new ArrayList<Object>(); List<OrderDetail> detailList = new ArrayList<OrderDetail>(); param.add(orderid); rs = DBUtil.query(sql, param); while(rs.next()) { OrderDetail od = new OrderDetail(); od.setDetailid(rs.getString("detailid")); od.setOrderid(rs.getString("orderid")); od.setProductid(rs.getString("productid")); od.setProductname(rs.getString("productname")); od.setBaseprice(rs.getDouble("baseprice")); od.setNum(rs.getInt("num")); detailList.add(od); } return detailList; } } 

 

ProductDao

package com.buaa.dao.impl; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.buaa.dao.IProductDao; import com.buaa.util.DBUtil; import com.buaa.vo.Product; public class ProductDao implements IProductDao{ private ResultSet rs = null; private String sql = null; public int getRecordCount(String name) throws SQLException { sql = "select count(*) c from product"; List<Object> param = new ArrayList<Object>(); if(name!=null && !"".equals(name)) { sql = "select count(*) c from product where name like ?"; param.add("%" + name + "%"); } rs = DBUtil.query(sql, param); int recordcount = 0; while(rs.next()) { recordcount = rs.getInt("c"); } return recordcount; } public List<Product> pageQueryProduct(int start, int end, String name) throws SQLException { sql = "select * from (select p.*, rownum rn from (select * from product order by productid) p where rownum<=?) where rn >?"; List<Object> param = new ArrayList<Object>(); if(name!=null && !"".equals(name)) { sql = "select * from (select p.*, rownum rn from (select * from product where name like ? order by productid) p where rownum<=?) where rn >?"; param.add("%" + name + "%"); } param.add(end); param.add(start); List<Product> pList = new ArrayList<Product>(); rs = DBUtil.query(sql, param); while(rs.next()) { Product p = new Product(); p.setProductid(rs.getString("productid")); p.setName(rs.getString("name")); p.setDescription(rs.getString("description")); p.setBaseprice(rs.getDouble("baseprice")); p.setWriter(rs.getString("writer")); p.setPublish(rs.getString("publish")); p.setPages(rs.getInt("pages")); p.setImages(rs.getString("images")); pList.add(p); } return pList; } public Product queryProductById(String id) throws SQLException { sql = "select * from product where productid=?"; List<Object> param = new ArrayList<Object>(); param.add(id); Product p = new Product(); rs = DBUtil.query(sql, param); while(rs.next()) { p.setProductid(rs.getString("productid")); p.setName(rs.getString("name")); p.setDescription(rs.getString("description")); p.setBaseprice(rs.getDouble("baseprice")); p.setWriter(rs.getString("writer")); p.setPublish(rs.getString("publish")); p.setPages(rs.getInt("pages")); p.setImages(rs.getString("images")); } return p; } } 

 

UserDao

package com.buaa.dao.impl; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.buaa.dao.IUserDao; import com.buaa.util.DBUtil; import com.buaa.vo.User; public class UserDao implements IUserDao{ private ResultSet rs = null; private String sql = null; public void insertUser(User user) throws SQLException { sql = "insert into t_user values(?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; List<Object> param = new ArrayList<Object>(); param.add(user.getUserid()); param.add(user.getUsername()); param.add(user.getPassword()); param.add(user.getStreet1()); param.add(user.getStreet2()); param.add(user.getCity())
4000
; param.add(user.getZip()); param.add(user.getEmail()); param.add(user.getHomephone()); param.add(user.getCellphone()); param.add(user.getOfficephone()); param.add(user.getTruename()); DBUtil.update(sql, param); } public User queryUserByName(String username) throws SQLException { sql = "select * from t_user where username=?"; List<Object> param = new ArrayList<Object>(); param.add(username); rs = DBUtil.query(sql, param); User user = new User(); while(rs.next()) { user.setUserid(rs.getString("userid")); user.setUsername(rs.getString("username")); user.setPassword(rs.getString("password")); user.setStreet1(rs.getString("street1")); user.setStreet2(rs.getString("street2")); user.setCity(rs.getString("city")); user.setZip(rs.getString("zip")); user.setEmail(rs.getString("email")); user.setHomephone(rs.getString("homephone")); user.setCellphone(rs.getString("cellphone")); user.setOfficephone(rs.getString("officephone")); user.setTruename(rs.getString("truename")); } return user; } public void updateUser(User user) throws SQLException { sql = "update t_user set username=?, password=?, street1=?, street2=?, city=?, zip=?," + " email=?, homephone=?, cellphone=?, officephone=?, truename=? where userid=?"; List<Object> param = new ArrayList<Object>(); param.add(user.getUsername()); param.add(user.getPassword()); param.add(user.getStreet1()); param.add(user.getStreet2()); param.add(user.getCity()); param.add(user.getZip()); param.add(user.getEmail()); param.add(user.getHomephone()); param.add(user.getCellphone()); param.add(user.getOfficephone()); param.add(user.getTruename()); param.add(user.getUserid()); DBUtil.update(sql, param); } } 

 

 

com.buaa.service

 

OrderDetailService

package com.buaa.service; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.buaa.dao.IOrderDetailDao; import com.buaa.dao.impl.OrderDetailDao; import com.buaa.util.DBUtil; import com.buaa.vo.OrderDetail; public class OrderDetailService { private IOrderDetailDao detailDao = new OrderDetailDao(); public List<OrderDetail> queryDetailByOrderid(String orderid) { DBUtil.openConnection(); List<OrderDetail> detailList = new ArrayList<OrderDetail>(); try { detailList = detailDao.queryDetailByOrderid(orderid); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { DBUtil.close(); } return detailList; } }

 

OrderService

package com.buaa.service; import java.sql.Connection; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; import java.util.List; import com.buaa.dao.IOrderDao; import com.buaa.dao.IOrderDetailDao; import com.buaa.dao.impl.OrderDao; import com.buaa.dao.impl.OrderDetailDao; import com.buaa.util.DBUtil; import com.buaa.util.Util; import com.buaa.vo.Cart; import com.buaa.vo.Order; import com.buaa.vo.OrderDetail; public class OrderService { private Connection conn = null; private IOrderDao orderDao = new OrderDao(); private IOrderDetailDao detailDao = new OrderDetailDao(); public void insertOrderAndDetail(double cost, String payType, String userid, List<Cart> cartList) { conn = DBUtil.openConnection(); try { conn.setAutoCommit(false); Order o = new Order(); o.setOrderid(Util.getUUID()); o.setCost(cost); o.setPayType(payType); o.setUserid(userid); o.setTime(new Timestamp(new Date().getTime())); orderDao.insertOrder(o); for(int i=0;i<cartList.size();i++) { OrderDetail od = new OrderDetail(); od.setDetailid(Util.getUUID()); od.setOrderid(o.getOrderid()); od.setProductid(cartList.get(i).getProductid()); od.setProductname(cartList.get(i).getProductName()); od.setBaseprice(cartList.get(i).getBaseprice()); od.setNum(cartList.get(i).getCount()); detailDao.insertOrderDetail(od); } conn.commit(); } catch (SQLException e) { e.printStackTrace(); try { conn.rollback(); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } finally { DBUtil.close(); } } public List<Order> queryOrderByUserid(String userid) { DBUtil.openConnection(); List<Order> orderList = new ArrayList<Order>(); try { orderList = orderDao.queryOrderByUserid(userid); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { DBUtil.close(); } return orderList; } public void deleteOrderAndDetail(String orderid) { conn = DBUtil.openConnection(); try { conn.setAutoCommit(false); detailDao.deleteOrderDetail(orderid); orderDao.deleteOrder(orderid); conn.commit(); } catch (SQLException e) { e.printStackTrace(); try { conn.rollback(); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } finally { DBUtil.close(); } } } 

 

ProductService

package com.buaa.service; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.buaa.dao.IProductDao; import com.buaa.dao.impl.ProductDao; import com.buaa.util.DBUtil; import com.buaa.vo.Product; public class ProductService { private IProductDao proDao = new ProductDao(); public List<Product> pageQueryProduct(int start, int end, String name) { DBUtil.openConnection(); List<Product> pList = new ArrayList<Product>(); try { pList = proDao.pageQueryProduct(start, end, name); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { DBUtil.close(); } return pList; } public int getRecordCount(String name) { DBUtil.openConnection(); int recordcount = 0; try { recordcount = proDao.getRecordCount(name); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { DBUtil.close(); } return recordcount; } public Product queryProductById(String id) { DBUtil.openConnection(); Product p = new Product(); try { p = proDao.queryProductById(id); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { DBUtil.close(); } return p; } } 

 

UserService

package com.buaa.service; import java.sql.Connection; import java.sql.SQLException; import com.buaa.dao.IUserDao; import com.buaa.dao.impl.UserDao; import com.buaa.util.DBUtil; import com.buaa.vo.User; public class UserService { private IUserDao userDao = new UserDao(); private Connection conn = null; public void insertUser(User user) { conn = DBUtil.openConnection(); try { conn.setAutoCommit(false); userDao.insertUser(user); conn.commit(); } catch (SQLException e) { e.printStackTrace(); try { conn.rollback(); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }finally { DBUtil.close(); } } public void updateUser(User user) { conn = DBUtil.openConnection(); try { conn.setAutoCommit(false); userDao.updateUser(user); conn.commit(); } catch (SQLException e) { e.printStackTrace(); try { conn.rollback(); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }finally { DBUtil.close(); } } public User queryUserByName(String username) { User user = new User(); DBUtil.openConnection(); try { user = userDao.queryUserByName(username); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { DBUtil.close(); } return user; } } 

 

com.buaa.servlet

AddCartServlet

package com.buaa.servlet; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.buaa.service.ProductService; import com.buaa.vo.Cart; import com.buaa.vo.Product; public class AddCartServlet extends HttpServlet { /** * Constructor of the object. */ public AddCartServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); String productid = request.getParameter("productid"); ProductService proService = new ProductService(); Product p = proService.queryProductById(productid); HttpSession session = request.getSession(); if(session.getAttribute("user")==null) { request.setAttribute("message", "请先登录"); request.getRequestDispatcher("login.jsp").forward(request, response); }else { List<Cart> cartList = (List<Cart>)session.getAttribute("cartList"); Cart cart = new Cart(); cart.setProductid(productid); cart.setProductName(p.getName()); cart.setBaseprice(p.getBaseprice()); if(cartList==null) { cart.setCount(1); cart.setAmount(cart.getBaseprice() * cart.getCount()); cartList = new ArrayList<Cart>(); cartList.add(cart); }else { boolean flag = true; for(int i=0;i<cartList.size();i++) { Cart c = cartList.get(i); if(c.getProductid().equals(productid)) { flag = false; c.setCount(c.getCount() + 1); c.setAmount(c.getBaseprice() * c.getCount()); } } if(flag) { cart.setCount(1); cart.setAmount(cart.getBaseprice() * cart.getCount()); cartList.add(cart); } } double sum = 0; for(int i=0;i<cartList.size();i++) { Cart c = cartList.get(i); sum = sum + c.getAmount(); } session.setAttribute("sum", sum); session.setAttribute("cartList", cartList); request.getRequestDispatcher("cart/cart.jsp").forward(request, response); } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } }

 

DelOrderServlet

package com.buaa.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.buaa.service.OrderService; public class DelOrderServlet extends HttpServlet { /** * Constructor of the object. */ public DelOrderServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request * the request send by the client to the server * @param response * the response send by the server to the client * @throws ServletException * if an error occurred * @throws IOException * if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to * post. * * @param request * the request send by the client to the server * @param response * the response send by the server to the client * @throws ServletException * if an error occurred * @throws IOException * if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); String orderid = request.getParameter("orderid"); OrderService orderService = new OrderService(); orderService.deleteOrderAndDetail(orderid); request.getRequestDispatcher("ViewOrderServlet").forward(request, response); } /** * Initialization of the servlet. <br> * * @throws ServletException * if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

LoginServlet

package com.buaa.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.buaa.service.UserService; import com.buaa.util.Util; import com.buaa.vo.User; public class LoginServlet extends HttpServlet { /** * Constructor of the object. */ public LoginServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); //获取页面传上来的用户名、密码 String username = request.getParameter("username").trim(); String password = Util.md5(request.getParameter("password").trim()); UserService userService = new UserService(); User user = userService.queryUserByName(username); HttpSession session = request.getSession(); if(user.getUsername()!=null && password.equals(user.getPassword())) { //如果用户名密码输入正确,将user对象放到session中并跳转页面 session.setAttribute("user"
13df4
, user); request.getRequestDispatcher("PageQueryProductServlet").forward(request, response); }else { request.setAttribute("message", "用户名或密码不正确"); request.getRequestDispatcher("login.jsp").forward(request, response); } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

LogoutServlet

package com.buaa.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class LogoutServlet extends HttpServlet { /** * Constructor of the object. */ public LogoutServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); HttpSession session = request.getSession(); if(session.getAttribute("user")!=null) { //如果用户已经登录允许退出(将user对象从session中去除) session.removeAttribute("user"); session.removeAttribute("cartList"); session.removeAttribute("sum"); request.getRequestDispatcher("PageQueryProductServlet").forward(request, response); }else { //如果用记未登录,不允许退出 request.setAttribute("message", "请先登录"); request.getRequestDispatcher("login.jsp").forward(request, response); } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

OrderSubmitServlet

package com.buaa.servlet; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.buaa.service.OrderService; import com.buaa.vo.Cart; import com.buaa.vo.User; public class OrderSubmitServlet extends HttpServlet { /** * Constructor of the object. */ public OrderSubmitServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); String payType = request.getParameter("payType"); HttpSession session = request.getSession(); User user = (User)session.getAttribute("user"); double cost = (Double)session.getAttribute("sum"); List<Cart> cartList = (List<Cart>)session.getAttribute("cartList"); OrderService orderService = new OrderService(); orderService.insertOrderAndDetail(cost, payType, user.getUserid(), cartList); session.removeAttribute("cartList"); session.removeAttribute("sum"); request.getRequestDispatcher("ViewOrderServlet").forward(request, response); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

PageQueryProductServlet

package com.buaa.servlet; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.buaa.service.ProductService; import com.buaa.vo.Page; import com.buaa.vo.Product; public class PageQueryProductServlet extends HttpServlet { /** * Constructor of the object. */ public PageQueryProductServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); ProductService proService = new ProductService(); int pagesize = 5; int pagenum = 1; String name = null; if(request.getParameter("pagesize")!=null) { pagesize = Integer.parseInt(request.getParameter("pagesize")); } if(request.getParameter("pagenum")!=null) { pagenum = Integer.parseInt(request.getParameter("pagenum")); } if(request.getParameter("name")!=null) { name = new String(request.getParameter("name").getBytes("ISO-8859-1"),"UTF-8"); } int start = pagesize * pagenum - pagesize; int end = pagesize * pagenum; int recordcount = proService.getRecordCount(name); int pagecount = recordcount / pagesize; if(recordcount%pagesize!=0) { pagecount++; } List<Product> pList = proService.pageQueryProduct(start, end, name); Page page = new Page(); page.setPagecount(pagecount); page.setPagenum(pagenum); page.setPagesize(pagesize); page.setRecordcount(recordcount); request.setAttribute("pList", pList); request.setAttribute("page", page); request.setAttribute("name", name); request.getRequestDispatcher("product/pageQueryProduct.jsp").forward(request, response); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

PreOrderSubmitServlet

package com.buaa.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class PreOrderSubmitServlet extends HttpServlet { /** * Constructor of the object. */ public PreOrderSubmitServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); request.getRequestDispatcher("order/preOrderSubmit.jsp").forward(request, response); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

PreUpdateUserServlet

package com.buaa.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class PreUpdateUserServlet extends HttpServlet { /** * Constructor of the object. */ public PreUpdateUserServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); HttpSession session = request.getSession(); if(session.getAttribute("user")!=null) { request.getRequestDispatcher("user/updateUser.jsp").forward(request, response); }else { request.setAttribute("message", "请先登录"); request.getRequestDispatcher("login.jsp").forward(request, response); } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

QueryOrderDetailServlet

package com.buaa.servlet; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.buaa.service.OrderDetailService; import com.buaa.vo.OrderDetail; public class QueryOrderDetailServlet extends HttpServlet { /** * Constructor of the object. */ public QueryOrderDetailServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); String orderid = request.getParameter("orderid"); OrderDetailService detailService = new OrderDetailService(); List<OrderDetail> detailList = detailService.queryDetailByOrderid(orderid); request.setAttribute("detailList", detailList); request.getRequestDispatcher("order/orderDetailList.jsp").forward(request, response); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

RemoveOrClearCartServlet

package com.buaa.servlet; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.buaa.vo.Cart; public class RemoveOrClearCartServlet extends HttpServlet { /** * Constructor of the object. */ public RemoveOrClearCartServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); request.setCharacterEncoding("utf-8"); String count = request.getParameter("count"); HttpSession session = request.getSession(); if(count!=null) { List<Cart> cartList = (List<Cart>)session.getAttribute("cartList"); cartList.remove(Integer.parseInt(count)-1); double sum = 0; for(int i=0;i<cartList.size();i++) { Cart c = cartList.get(i); sum = sum + c.getAmount(); } session.setAttribute("sum", sum); session.setAttribute("cartList", cartList); }else { session.removeAttribute("cartList"); session.removeAttribute("sum"); } request.getRequestDispatcher("cart/cart.jsp").forward(request, response); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

RigisterUpdateUserServlet

package com.buaa.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.buaa.service.UserService; import com.buaa.util.Util; import com.buaa.vo.User; public class RigisterUpdateUserServlet extends HttpServlet { /** * Constructor of the object. */ public RigisterUpdateUserServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); String userid = request.getParameter("userid")==null?"":request.getParameter("userid").trim(); String username = request.getParameter("username")==null?"":request.getParameter("username").trim(); String password = request.getParameter("password")==null?"":request.getParameter("password").trim(); String street1 = request.getParameter("street1")==null?"":request.getParameter("street1").trim();; String street2 = request.getParameter("street2")==null?"":request.getParameter("street2").trim(); String city = request.getParameter("city")==null?"":request.getParameter("city").trim(); String zip = request.getParameter("zip")==null?"":request.getParameter("zip").trim(); String email = request.getParameter("email")==null?"":request.getParameter("email").trim(); String homephone = request.getParameter("homephone")==null?"":request.getParameter("homephone").trim(); String cellphone = request.getParameter("cellphone")==null?"":request.getParameter("cellphone").trim(); String officephone = request.getParameter("officephone")==null?"":request.getParameter("officephone").trim(); String truename = request.getParameter("truename")==null?"":request.getParameter("truename").trim(); User user = new User(); user.setUsername(username); //user.setPassword(password); user.setStreet1(street1); user.setStreet2(street2); user.setCity(city); user.setZip(zip); user.setEmail(email); user.setHomephone(homephone); user.setCellphone(cellphone); user.setOfficephone(officephone); user.setTruename(truename); UserService userService = new UserService(); HttpSession session = request.getSession(); if(userid.equals("")) { user.setUserid(Util.getUUID()); user.setPassword(Util.md5(password)); userService.insertUser(user); }else { User sessionUser = (User)session.getAttribute("user"); if(!password.equals(sessionUser.getPassword())) { user.setPassword(Util.md5(password)); }else { user.setPassword(password); } user.setUserid(userid); userService.updateUser(user); } session.setAttribute("user", user); request.getRequestDispatcher("PageQueryProductServlet").forward(request, response); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

ShowCartServlet

package com.buaa.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class ShowCartServlet extends HttpServlet { /** * Constructor of the object. */ public ShowCartServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); HttpSession session = request.getSession(); if(session.getAttribute("user")==null) { request.setAttribute("message", "请先登录"); request.getRequestDispatcher("login.jsp").forward(request, response); }else { request.getRequestDispatcher("cart/cart.jsp").forward(request, response); } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

UpdateCartServlet

package com.buaa.servlet; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.buaa.vo.Cart; public class UpdateCartServlet extends HttpServlet { /** * Constructor of the object. */ public UpdateCartServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); int count = Integer.parseInt(request.getParameter("count")); int v = Integer.parseInt(request.getParameter("v")); HttpSession session = request.getSession(); List<Cart> cartList = (List<Cart>)session.getAttribute("cartList"); Cart cart = cartList.get(v-1); cart.setCount(count); cart.setAmount(cart.getBaseprice() * cart.getCount()); double sum = 0; for(int i=0;i<cartList.size();i++) { Cart c = cartList.get(i); sum = sum + c.getAmount(); } session.setAttribute("sum", sum); session.setAttribute("cartList", cartList); request.getRequestDispatcher("cart/cart.jsp").forward(request, response); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

ViewOrderServlet

package com.buaa.servlet; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.buaa.service.OrderService; import com.buaa.vo.Order; import com.buaa.vo.User; public class ViewOrderServlet extends HttpServlet { /** * Constructor of the object. */ public ViewOrderServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); HttpSession session = request.getSession(); OrderService orderService = new OrderService(); if(session.getAttribute("user")==null) { request.setAttribute("message", "请先登录"); request.getRequestDispatcher("login.jsp").forward(request, response); }else { User user = (User)session.getAttribute("user"); List<Order> orderList = orderService.queryOrderByUserid(user.getUserid()); request.setAttribute("orderList", orderList); request.getRequestDispatcher("order/viewOrder.jsp").forward(request, response); } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

ViewProductServlet

package com.buaa.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.buaa.service.ProductService; import com.buaa.vo.Product; public class ViewProductServlet extends HttpServlet { /** * Constructor of the object. */ public ViewProductServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); String id = request.getParameter("productid"); ProductService proService = new ProductService(); Product p = proService.queryProductById(id); request.setAttribute("p", p); request.getRequestDispatcher("product/viewProduct.jsp").forward(request, response); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } 

 

com.buaa.util

DBUtil

package com.buaa.util; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; public class DBUtil { private static String driver = "oracle.jdbc.driver.OracleDriver"; private static String url = "jdbc:oracle:thin:@localhost:1521:orcl"; private static String user = "sunxun"; private static String password = "123"; private static Connection conn = null; private static PreparedStatement ps = null; private static ResultSet rs = null; public static Connection openConnection() { try { Class.forName(driver); conn = DriverManager.getConnection(url, user, password); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return conn; } public static ResultSet query(String sql, List<Object> param) throws SQLException{ ps = conn.prepareStatement(sql); if(param!=null && param.size()>0) { for(int i=0;i<param.size();i++) { ps.setObject(i + 1, param.get(i)); } } rs = ps.executeQuery(); return rs; } public static void update(String sql, List<Object> param) throws SQLException{ ps = conn.prepareStatement(sql); if(param!=null && param.size()>0) { for(int i=0;i<param.size();i++) { ps.setObject(i + 1, param.get(i)); } } ps.executeUpdate(); } public static void close() { try { if(rs!=null) { rs.close(); } if(ps!=null) { ps.close(); } if(conn!=null) { conn.close(); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }

 

Util

package com.buaa.util; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.UUID; import sun.misc.BASE64Encoder; public class Util { //返回主键 public static String getUUID() { UUID uuid = UUID.randomUUID(); return uuid.toString(); } //md5加密 public static String md5(String password) { String key = "buaa"; password = password + key; MessageDigest md = null; try { md = MessageDigest.getInstance("md5"); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } BASE64Encoder en = new BASE64Encoder(); return en.encode(md.digest(password.getBytes())); } } 

 

com.buaa.vo

Cart

package com.buaa.vo; public class Cart { private String productid; private String productName; private double baseprice; private int count; private double amount; public String getProductid() { return productid; } public void setProductid(String productid) { this.productid = productid; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public double getBaseprice() { return baseprice; } public void setBaseprice(double baseprice) { this.baseprice = baseprice; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public double getAmount() { return amount; } public void setAmount(double amount) { this.amount = amount; } }

 

Order

package com.buaa.vo; import java.sql.Timestamp; public class Order { private String orderid; private double cost; private String payType; private String userid; private Timestamp time; public String getOrderid() { return orderid; } public void setOrderid(String orderid) { this.orderid = orderid; } public double getCost() { return cost; } public void setCost(double cost) { this.cost = cost; } public String getPayType() { return payType; } public void setPayType(String payType) { this.payType = payType; } public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } public Timestamp getTime() { return time; } public void setTime(Timestamp time) { this.time = time; } }

 

OrderDetail

package com.buaa.vo; public class OrderDetail { private String detailid; private String orderid; private String productid; private String productname; private double baseprice; private int num; public String getDetailid() { return detailid; } public void setDetailid(String detailid) { this.detailid = detailid; } public String getOrderid() { return orderid; } public void setOrderid(String orderid) { this.orderid = orderid; } public String getProductid() { return productid; } public void setProductid(String productid) { this.productid = productid; } public String getProductname() { return productname; } public void setProductname(String productname) { this.productname = productname; } public double getBaseprice() { return baseprice; } public void setBaseprice(double baseprice) { this.baseprice = baseprice; } public int getNum() { return num; } public void setNum(int num) { this.num = num; } }

 

Page

package com.buaa.vo; public class Page { private int pagesize; private int pagenum; private int pagecount; private int recordcount; public int getPagesize() { return pagesize; } public void setPagesize(int pagesize) { this.pagesize = pagesize; } public int getPagenum() { return pagenum; } public void setPagenum(int pagenum) { this.pagenum = pagenum; } public int getPagecount() { return pagecount; } public void setPagecount(int pagecount) { this.pagecount = pagecount; } public int getRecordcount() { return recordcount; } public void setRecordcount(int recordcount) { this.recordcount = recordcount; } }

 

Product

package com.buaa.vo; public class Product { private String productid; private String name; private String description; private double baseprice; private String writer; private String publish; private int pages; private String images; public String getProductid() { return productid; } public void setProductid(String productid) { this.productid = productid; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public double getBaseprice() { return baseprice; } public void setBaseprice(double baseprice) { this.baseprice = baseprice; } public String getWriter() { return writer; } public void setWriter(String writer) { this.writer = writer; } public String getPublish() { return publish; } public void setPublish(String publish) { this.publish = publish; } public int getPages() { return pages; } public void setPages(int pages) { this.pages = pages; } public String getImages() { return images; } public void setImages(String images) { this.images = images; } }

 

User

package com.buaa.vo; public class User { private String userid; private String username; private String password; private String street1; private String street2; private String city; private String zip; private String email; private String homephone; private String cellphone; private String officephone; private String truename; public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getStreet1() { return street1; } public void setStreet1(String street1) { this.street1 = street1; } public String getStreet2() { return street2; } public void setStreet2(String street2) { this.street2 = street2; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getHomephone() { return homephone; } public void setHomephone(String homephone) { this.homephone = homephone; } public String getCellphone() { return cellphone; } public void setCellphone(String cellphone) { this.cellphone = cellphone; } public String getOfficephone() { return officephone; } public void setOfficephone(String officephone) { this.officephone = officephone; } public String getTruename() { return truename; } public void setTruename(String truename) { this.truename = truename; } }

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  SQL