1、1 网上书店购物系统需求文档 写明需求分析文档(>200字)、写明系统功能需求(可加入UML的用例图) 1)网上书店购物系统包括了用户模块(其功能模块有:登陆、注销模块、注册模块)、图书管理模块(其功能模块有:显示分类、浏览图书)、购物模块(其功能模块有:加入购物车、查看购物车、结账) 2)功能模块 网上书店是一个典型的基于Web网站的Java EE软件系统,集成了诸多的功能模块,主要包括: (1)显示图书分类。 (2)用户可以根据分类浏览某一类图书列表。 (3)用户可以查看具体某一本书的简介。 (4)在图书浏览页只要单击【购买】按钮,就可把选定的图书加入购物车中。 (5)用
2、户可以随时单击 ,查看车中已购图书的信息。 (6)已登录的用户可以单击【结账】按钮下订单。 (7)使用需先注册,在注册页填写个人信息,确认有效后成为新用户。 (8)用户在登录页填写用户名和密码,确认正确后才可结账。 功能模块和展现 2 系统设计文档 (>500字、至少包含一个主要模块的内容设计) 1)系统数据库设计 包括ER图,数据 创建数据库 网上书店有以下5个实体:用户、图书分类、图书、订单、订单项,因此,本系统的数据库设计,如下图 数据库的初始数据 create table book ( bookid
3、 int auto_increment not null, catalogid int not null, bookname varchar(20) not null, price int not null, picture varchar(30) not null, primary key (bookid) ); create table catalog ( catalogid int auto_incre
4、ment not null, catalogname varchar(20) not null, primary key (catalogid) ); create table orderitem ( orderitemid int auto_increment not null, bookid int not null, orderid int not null, quantity int not null, prim
5、ary key (orderitemid) ); create table orders ( orderid int auto_increment not null, userid int not null, orderdate timestamp not null, primary key (orderid) ); create table user ( userid int auto_increment not null, us
6、ername varchar(20) not null, password varchar(20) not null, sex varchar(4), age int, primary key (userid) ); alter table book add constraint FK_Relationship_3 foreign key (catalogid) references catalog (catalogid) on
7、delete restrict on update restrict; alter table orderitem add constraint FK_Relationship_2 foreign key (orderid) references orders (orderid) on delete restrict on update restrict; alter table orderitem add constraint FK_Relationship_4 foreign key (bookid) references book (bookid) on
8、delete restrict on update restrict; alter table orders add constraint FK_Relationship_1 foreign key (userid) references user (userid) on delete restrict on update restrict; 向catalog表输入记录的SQL语句: INSERT INTO catalog VALUES(1, 'C语言程序设计'); INSERT INTO catalog VALUES(2, 'Java开发'); INSERT INTO
9、 catalog VALUES(3, '数据库'); INSERT INTO catalog VALUES(4, '网页编程'); 向book表输入记录: INSERT INTO book VALUES(1, 4, 'ASP.NET 3.5实用教程', 38, 'ASP.NET3.5.jpg'); INSERT INTO book VALUES(2, 1, 'C#实用教程', 43, 'CSharp.jpg'); INSERT INTO book VALUES(3, 1, 'C实用教程', 36, 'C.jpg'); INSERT INTO book VALUES(4, 1, 'C
10、实用教程', 40, 'C++.jpg'); INSERT INTO book VALUES(5, 4, 'Flex 4开发实践', 45, 'Flex4.jpg'); INSERT INTO book VALUES(6, 2, 'Java EE基础实用教程', 35, 'JavaEEBasic.jpg'); INSERT INTO book VALUES(7, 2, 'Java EE实用教程', 39, 'JavaEE.jpg'); INSERT INTO book VALUES(8, 2, 'Java实用教程(第2版)', 50, 'Java.jpg'); INSERT IN
11、TO book VALUES(9, 4, 'JSP编程教程', 30, 'JSP.jpg'); INSERT INTO book VALUES(10, 3, 'MySQL实用教程', 37, 'MySQL.jpg'); INSERT INTO book VALUES(11, 3, 'Oracle实用教程(第3版)', 29, 'Oracle.jpg'); INSERT INTO book VALUES(12, 4, 'PHP实用教程', 35, 'PHP.jpg'); INSERT INTO book VALUES(13, 3, 'SQL Server实用教程(第3版)', 25, '
12、SQL Server.jpg'); INSERT INTO book VALUES(14, 1, 'Visual C++教程(第2版)', 25, 'VC++.jpg'); 2)程序流程图设计,可以采用面向对象或面向结构的设计方法进行设计 3)框架设计,至少选择一种框架技术 以Spring为核心的整合思路 本节3个框架整合的架构如图所示,Spring作为一个统一的大容器来用,在它里面容纳(注册)了Action、DAO等组件。 (1)添加Spring开发能力 右击项目名,依次选择菜单【MyEclipse】→【Add Spring Capabilities…】,将出现如图所示的界面,选中要应用的Spring版本及所需的类库 (2)添加Hibernate并持久化user表 1) 加载Hibernate框架 右击项目名,选择菜单【MyEclipse】→【Add Hibernate Capabilities…】 (3)加载、配置Struts 2框架 ① 加载Struts 2包。 考虑到接下来的配置要将Struts 2与Spring集成的需要,添加一个struts2-spring-plugin-2.3.4.1.jar包。 (4)在三个框架全整合的基础上,开发一个业务层, 系统实现代码






