商品销售系统修改.docx

上传人:b****5 文档编号:4652630 上传时间:2022-12-07 格式:DOCX 页数:38 大小:724.90KB
下载 相关 举报
商品销售系统修改.docx_第1页
第1页 / 共38页
商品销售系统修改.docx_第2页
第2页 / 共38页
商品销售系统修改.docx_第3页
第3页 / 共38页
商品销售系统修改.docx_第4页
第4页 / 共38页
商品销售系统修改.docx_第5页
第5页 / 共38页
点击查看更多>>
下载资源
资源描述

商品销售系统修改.docx

《商品销售系统修改.docx》由会员分享,可在线阅读,更多相关《商品销售系统修改.docx(38页珍藏版)》请在冰豆网上搜索。

商品销售系统修改.docx

商品销售系统修改

目录

绪论1

1环境搭建2

1.1下载及安装jdk2

1.2下载IDE及服务器2

1.3下载所需框架2

1.4下载数据库驱动器2

1.5jpa环境的搭建2

1.5.1导入hibernate所需包2

1.5.2新建工程及编写配置文件2

1.5.3编写实体Bean3

1.5.4编写测试类4

1.5.5运行测试类5

1.6Spring与jpa的集成5

1.6.1导入Spring所需的架包5

1.6.2Spring配置文件application.xml的编写6

1.6.3编写实体bean的业务接口8

1.6.4编写测试类9

1.6.5运行测试程序10

1.7导入struts架包10

2功能模块划分11

2.1产品管理11

2.2产品前端显示11

2.3产品全文搜索11

2.4购物车11

2.5用户管理11

2.6订购流程11

2.7订单处理流程11

2.8用户评论管理12

2.9权限管理12

2.10缓存管理12

2.11网页静态化12

2.12数据统计12

2.13部门管理12

2.14员工管理12

2.15资讯管理12

3平台技术框架13

4系统运行15

4.1导入系统15

4.2创建数据集15

4.3数据配置文件15

4.4系统初始化15

4.5访问主页15

4.6访问后台15

5功能展示16

5.1后台系统16

5.1.1员工登陆16

5.1.2后台管理模块16

5.1.3产品管理16

5.1.4产品品牌管理17

5.1.5产品类别管理17

5.1.3权限管理18

5.1.4订单管理20

5.2前台显示20

6系统代码的分析及设计思想24

6.1对实体bean业务逻辑都需要的方法的封装:

24

6.2权限控制31

6.2.1粗力度的权限控制31

6.2.2细力度的权限控制33

参考文献39

致谢40

 

商品销售系统

摘要

本文是介绍一个网上销售系统的开发过程,重点在于学习如何使用三大框架,怎么集成三大框架,如何进行软件开发。

详细的解释了web开发的流程,介绍了系统的功能模块,代码的功能以及其中的原理,重要的是将环境搭建说的很清楚,这样一来可以轻而易举的写出高水平的java程序。

随着社会的进步,网络进入家家户户,上网不在是人们的奢侈品了。

人们上网查阅资料学习以及在网上购物都是很平常的事情。

拥有一个自己的网上销售平台是一件非常高兴的事情。

要是自己能写一个出来那就是完美了。

文章中针对一个系统给出了设计要点。

结合程序源代码,能给有志向开自己的网上销售平台的朋友有所帮助。

使用本系统要学习如下课程:

j2ee、Spring、Hibernate、Struts、Servlet、ajax、网页设计。

最重要的是懂得使用编译器及服务器如:

Myeclipse与tomcat。

【关键词】框架功能配置技术

 

Merchandisesalessystem

Abstract

Thisisanonlinesalessystemdevelopmentprocess,thekeyliesinlearninghowtousethethreeframework,howintegratedframeworkthree,howsoftwaredevelopment.Adetailedexplanationofthewebdevelopmentprocess,introducesthesystemfunctionmodule,thefunctionandthecodeisimportantprinciple,willbuildtheenvironmentthatclearly,sothatcanbeeasilywriteahighlevelofJavaprogram.Alongwiththeprogressofthesociety,thenetworkintoeveryfamily,theInternetisnotaluxury.Peopletoaccessinformationonlineshoppingonlinelearningandareverycommonthings.Haveanownonlinesalesplatformisaveryhappythings.Ifyoucanwriteaoutthatisperfect.Articleaimedatagivenpointsystemdesign.Combinedwithsourcecode,andcangiveawaytheirambitiousInternetdistributionplatformfriendshelp.Usingthissystemtolearnlessonsareasfollows:

thej2eeandHibernate,Servlet,ajax,Struts,andwebdesign.Themostimportantistousethecompilerandserversas:

Myeclipsetomcatwith.

【Keywords】FrameFunctionConfiguretechnology

 

绪论

软件系统是企业及个人都需要用到的,一个好的软件能给企业员工带来无限的方便,能为企业节约大量的资金。

目前运用java技术开发系统还是很主流的。

由此,我利用所学的知识开发了一个网上销售系统。

系统中所涉及到得知识包括java基础知识,主流的三大框架,网页的设计等。

系统给我们带来了很大的方便,当然在开发阶段还是要付出很大的代价的,本文针对系统的开发进行了全面的解说,从系统所需的环境搭建到代码的功能及如何实现,从系统所包含的业务功能到业务功能是如何实现的一一呈现在我们面前。

文章最注重的是让读者了解软件开发。

当然,读者必须熟悉论文中涉及的知识。

最后,希望读者能够指出本人的不足之处,提出宝贵的意见,本人将不胜感谢。

1环境搭建

1.1下载及安装jdk

下载javajdk1.5安装到电脑上,配置好java环境,在dos下运行javac程序检验java环境搭建成功。

1.2下载IDE及服务器

下载Myeclipse7.0及tomcat6.0的安装包并将它们安装到电脑上。

1.3下载所需框架

下载所需的三大框架架包,其中struts的版本是3.1.8,hibernate3.3.2,Spring2.5.6。

1.4下载数据库驱动器

由于系统的开发肯定是要数据库的,在本系统中用到的是Mysql,所以要下载并安装Mysql到本地,其中我用到的版本号是5.0。

要用数据库,连接数据库的驱动程序是不可少的,必须下载一个Mysql的数据库驱动架包。

1.5jpa环境的搭建

1.5.1导入hibernate所需包

导入hibernate3.3.2核心包下的hibernate3.jar、lib\bytecode\cglib\hibernate-cglib-repack-2.1_3.jar、lib\required\*.jar(*表示在这个目录下的所有架包)。

hibernate注解包中的hibernate-annotations.jar、lib\ejb3-persistence.jar、lib\hibernate-commons-annotations.jar。

hibernate针对JPA的实现包中的hibernate-entitymanager.jar、lib\test\log4j.jar、lib\test\slf4j-log4j12.jar。

1.5.2新建工程及编写配置文件

新建工程,将上述的架包导入到工程中,在工程目录下新建目录META-INF,再在它下新建persistence.xml文件。

文件中的内容为:

xmlversion="1.0"?

>

xmlns:

xsi="http:

//www.w3.org/2001/XMLSchema-instance"

xsi:

schemaLocation="

version="1.0">

org.hibernate.ejb.HibernatePersistence

value="org.hibernate.dialect.MySQL5Dialect"/>

value="org.gjt.mm.mysql.Driver"/>

mysql:

//localhost:

3306/mytest?

useUnicode=true&characterEncoding=UTF-8"/>

大概意思是:

所选用的数据库为Mysql、驱动程序为org.gjt.mm.mysql.Driver。

数据库用户名为root密码是123、所使用的数据库名为mytest。

1.5.3编写实体Bean

packageorg.lfj.bean.product;

importjavax.persistence.Entity;

importjavax.persistence.GeneratedValue;

importjavax.persistence.GenerationType;

importjavax.persistence.Id;

@Entity

publicclassProductType{

privateIntegertypeid;

@Id@GeneratedValue(strategy=GenerationType.AUTO)

publicIntegergetTypeid(){

returntypeid;

}

publicvoidsetTypeid(Integertypeid){

this.typeid=typeid;

}

}

其中@Entity注明这个类将要映射到数据库中去且对应的表名为producttype。

@Id@GeneratedValue(strategy=GenerationType.AUTO)表示ProductType这个类中的typeid这个字段是对应表中的主键且主键id是自动增长的,由字段类型可以知道是数值型的。

1.5.4编写测试类

packagejunit.test;

 

importjavax.persistence.EntityManager;

importjavax.persistence.EntityManagerFactory;

importjavax.persistence.Persistence;

importorg.junit.BeforeClass;

importorg.junit.Test;

importorg.lfj.bean.product.ProductType;

publicclassProductTest{

@BeforeClass

publicstaticvoidsetUpBeforeClass()throwsException{

}

@Test

publicvoidruntest(){

EntityManagerFactoryfactory=Persistence.createEntityManagerFactory("itcast");

EntityManagerem=factory.createEntityManager();

em.getTransaction().begin();

em.persist(newProductType());

em.getTransaction().commit();

em.close();

factory.close();

}

}

用@Test注解注释的是所需要运行的代码段,其中的factory变量是读取persistence.xml文件创建出来。

em这个变量是用来对数据库进行操作的实体。

接下来的代码是对数据库开启事物,添加数据到数据库中,提交事物,关闭数据库。

1.5.5运行测试类

如果运行后显示为绿条表示程序没有错误。

再检查数据库,如果在数据库中的对应表中成功的添加了数据进去,那么我们的jpa环境是搭建好了。

1.6Spring与jpa的集成

1.6.1导入Spring所需的架包

导入Spring所需要的架包,首先最为关键的架为:

spring-framework-2.5.6\dist\spring.jar是Spring的核心。

aop编程所需的架包spring-framework-2.5.6\lib\aopalliance\aopalliance.jar。

切面编程所需的架包在spring-framework-2.5.6\lib\aspectj这个目录下的aspectjrt.jar与aspectjweaver.jar。

代理所需的包spring-framework-2.5.6\lib\cglib\cglib-nodep-2.1_3.jar。

与持久层数据库打交道的spring-framework-2.5.6\lib\jakarta-commons\commons-dbcp、commons-logging.jar及commons-pool.jar。

由于要基于注解编程即还需要j2ee中的注解包spring-framework-2.5.6\lib\j2ee\common-annotations.jar,还有spring的struts的管理架包spring-webmvc-struts.jar。

当然这是要集成struts才用到的,我先将它也导入进来。

1.6.2Spring配置文件application.xml的编写

xmlversion="1.0"encoding="UTF-8"?

>

//www.springframework.org/schema/beans"

xmlns:

xsi="http:

//www.w3.org/2001/XMLSchema-instance"

xmlns:

context="http:

//www.springframework.org/schema/context"

xmlns:

aop="http:

//www.springframework.org/schema/aop"

xmlns:

tx="http:

//www.springframework.org/schema/tx"

xsi:

schemaLocation="http:

//www.springframework.org/schema/beans

http:

//www.springframework.org/schema/beans/spring-beans-2.5.xsd

http:

//www.springframework.org/schema/context

http:

//www.springframework.org/schema/context/spring-context-2.5.xsd

http:

//www.springframework.org/schema/aophttp:

//www.springframework.org/schema/aop/spring-aop-2.5.xsd

http:

//www.springframework.org/schema/txhttp:

//www.springframework.org/schema/tx/spring-tx-2.5.xsd">

aspectj-autoproxy/>

component-scanbase-package="org.lfj"/>

property-placeholderlocation="classpath:

jdbc.properties"/>

META-INF/persistence.xml"/>

annotation-driventransaction-manager="transactionManager"/>

先解释一下这个文件的主要意义:

aspectj-autoproxy/>实现切面编程。

component-scanbase-package=”org.lfj”/>Spring中的自动扫描机制,其中被扫描的类在org.lfj这个包下的所有类。

property-placeholderlocation="classpath:

jdbc.properties"/>

这里是注入数据库的主要代码量,其中连接了jdbc.properties文件为这些value赋值。

jdbc.propertites的内容如下所示:

driverClassName=org.gjt.mm.mysql.Driver

url=jdbc\:

mys

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 初中教育 > 政史地

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1