本文讲述了一个二手图书交易网站的开发过程
本文首先介绍了二手网上购物系统的开发背景及意义,然后论述了系统的需求分析和系统设计方案,较详细的论述了系统的详细设计和实现,并对系统进行了测试。最后,本文对二手网上购物系统进行了性能分析并提出了还需要改进的问题。 系统主要为用户提供了会员注册,商品搜索,评价,用户积分等功能,用户可以很方便的注册成为网上会员,对其他同学发布的商品进行浏览、检索,查看商品的详细资料和购买等,然后根据自己的需要选购自己看中的商品,也可以发布自己的物品进行销售、交换和出租等;为管理员提供了商品管理,用户管理管理,订单信息管理,系统管理等功能,系统管理员可以方便的对用户发布的商品进行管理,审查已注册的用户并对用户订单进行处理。在设计方面,本系统采用MVC模式,同时使用JSP技术进行动态页面的设计,使用Ajax进行页面异步交互。后台数据库选用MYSQL数据库。
它的部分数据库表摘录如下
表9 留言表
字段名称 | 字段大小 | 字段类型 | 说明 |
customerId | 4 | int | 用户编号 |
serviceAssessment | 255 | varchar | 内容 |
assessmentTime | 50 | varchar | 时间 |
Iscooled |
|
| 是否审核 |
表10 系统用户表
字段名称 | 字段大小 | 字段类型 | 说明 |
id | 4 | int | 编号 |
userName | 20 | varchar | 名称 |
userPwd | 20 | varchar | 密码 |
其中部分关键的代码摘录如下
package com.control.web;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.dao.GoodsInfoDAO;
import com.entity.PageModel;
import com.util.PublicToolPageModel;
public class MoreProductInfo extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = -307259351120301377L;
/**
* Constructor of the object.
*/
public MoreProductInfo() {
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 {
String typeDetailInfo = request.getParameter("typeDetailInfo");
typeDetailInfo = new String(typeDetailInfo.getBytes("iso-8859-1"),"utf-8");
String currentPage = request.getParameter("currentPage");
GoodsInfoDAO gdao = new GoodsInfoDAO();
int sumCount = gdao.getSumProductCount(typeDetailInfo);
//设置分页PageModel对象
PageModel pm = PublicToolPageModel.getPageInfo(request, sumCount,12,currentPage);
//查询所有的图书信息
ArrayList<Object> moreProductInfoList = gdao.getPageModel(pm, typeDetailInfo);
//将moreProductInfoList信息存放在Request中,然后跳转到显示页面
request.setAttribute("moreProductInfoList", moreProductInfoList);
request.getRequestDispatcher("../web/moreProductInfo.jsp").forward(request, response);
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}