基于ssm框架和freemarker的商品销售系统

项目说明

1、项目文件结构

 

 

2、项目主要接口及其实现

 (1)Index:

首页页面:展示商品功能,可登录或查看商品详细信息

 

 (2)登录:/ApiLogin

 

 

3、dao层

数据持久化层,把商品和用户信息寸进mysql数据库

(1)ContentDao

 

 

 (2)PersonDao

 

(3)ProductDao

 

(4)TransactionDao

 

4、spring配置文件和mybatis配置文件

spring-mvc.xml

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4        xmlns:context="http://www.springframework.org/schema/context"
 5        xmlns:mvc="http://www.springframework.org/schema/mvc"
 6        xsi:schemaLocation="http://www.springframework.org/schema/beans
 7                         http://www.springframework.org/schema/beans/spring-beans.xsd
 8                         http://www.springframework.org/schema/context
 9                         http://www.springframework.org/schema/context/spring-context.xsd
10                         http://www.springframework.org/schema/mvc
11                         http://www.springframework.org/schema/mvc/spring-mvc.xsd">
12 
13     <!-- 自动扫描该包,使SpringMVC认为包下用了@controller注解的类是控制器 -->
14     <context:component-scan base-package="com.web.controller"></context:component-scan>
15     <!-- 扩充了注解驱动,可以将请求参数绑定到控制器参数 -->
16     <mvc:annotation-driven/>
17     <mvc:default-servlet-handler/>
18     
19     <!-- 配置事务管理器
20     <bean id="transactionManager"
21           class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
22         <!- 注入数据库连接池 ->
23         <property name="dataSource" ref="dataSource"/>
24     </bean>
25     -->
26     <!-- freemarker配置 -->
27     <bean id="freemarkerConfig"
28           class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
29         <property name="templateLoaderPath" value="/WEB-INF/freemarker" />
30         <property name="templateLoaderPaths" value="/template"/>
31         <property name="freemarkerSettings">
32             <props>
33                 <prop key="template_update_delay">0</prop><!--刷新模板的周期,单位为秒-->
34                 <prop key="defaultEncoding">UTF-8</prop><!--模板的编码格式 -->
35             </props>
36         </property>
37     </bean>
38     <!-- freemarker视图解析器 -->
39     <bean
40             class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
41         <property name="viewResolvers">
42             <list>
43                 <bean id="viewResolver"
44                       class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
45                     <property name="cache" value="true" />
46                     <property name="prefix" value="" />
47                     <property name="suffix" value=".ftl" />
48                     <property name="contentType" value="text/html; charset=UTF-8" />
49                 </bean>
50             </list>
51         </property>
52         <property name="defaultViews">
53             <list>
54                 <bean
55                         class="org.springframework.web.servlet.view.json.MappingJackson2JsonView" />
56             </list>
57         </property>
58     </bean>
59     <!-- SpringMVC上传文件时,需要配置MultipartResolver处理器 -->
60     <bean id="multipartResolver"
61           class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
62         <property name="defaultEncoding" value="UTF-8" />
63         <!-- 指定所上传文件的总大小,单位字节。注意maxUploadSize属性的限制不是针对单个文件,而是所有文件的容量之和 -->
64         <property name="maxUploadSize" value="10240000" />
65     </bean>
66 
67     <!--注册拦截器-->
68 
69 </beans>

 

spring-mybatis.xml

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <!-- 配置文件需要引入的类 -->
 3 <beans xmlns="http://www.springframework.org/schema/beans"
 4        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 5        xmlns:context="http://www.springframework.org/schema/context"
 6        xmlns:mybatis="http://mybatis.org/schema/mybatis-spring"
 7        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 8 
 9         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
10 
11 
12 
13 
14         http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring.xsd">
15     <!-- scanner -->
16     <context:component-scan base-package="com.web.service"></context:component-scan>
17     <context:component-scan base-package="com.web.service.impl"></context:component-scan>
18 
19 
20     <!-- Spring and mybatis-->
21     <mybatis:scan base-package="com.web.dao"/>
22 
23 
24     <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
25         <property name="dataSource" ref="dataSource"/>
26     </bean>
27 
28     <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
29           destroy-method="close">
30         <property name="driverClassName" value="${jdbc.driverClassName}"></property>
31         <property name="url" value="${jdbc.url}"></property>
32         <property name="username" value="${jdbc.username}"></property>
33         <property name="password" value="${jdbc.password}"></property>
34         <!-- 初始化连接大小 -->
35         <property name="initialSize" value="${initialSize}"></property>
36         <!-- 连接池最大数量 -->
37         <property name="maxActive" value="${maxActive}"></property>
38         <!-- 连接池最大空闲 -->
39         <property name="maxIdle" value="${maxIdle}"></property>
40         <!-- 连接池最小空闲 -->
41         <property name="minIdle" value="${minIdle}"></property>
42         <!-- 获取连接最大等待时间 -->
43         <property name="maxWait" value="${maxWait}"></property>
44     </bean>
45 
46     <context:property-placeholder location="classpath:db.properties"/>
47 
48     <!-- 配置基于注解的声明式事务
49     <bean id="transactionManager"
50                 class="org.springframework.orm.jpa.JpaTransactionManager">
51         <property name="dataSource" ref="dataSource" />
52     </bean>
53 
54     <tx:annotation-driven transaction-manager="transactionManager"/>
55     -->
56 </beans>

 

db.properties

 1 jdbc.driverClassName= com.mysql.jdbc.Driver
 2 jdbc.url= jdbc:mysql://localhost:3306/shen_db?characterEncoding=utf8&useSSL=true
 3 jdbc.username=root
 4 jdbc.password=123456
 5 initialSize=0
 6 #定义最大连接数
 7 maxActive=20
 8 #定义最大空闲
 9 maxIdle=20
10 #定义最小空闲
11 minIdle=1
12 #定义最长等待时间
13 maxWait=60000

 

5、运行截图

 

首页

 

 买家购物车

 

买家账单

 

卖家发布商品界面

 

转载于:https://www.cnblogs.com/shenzhi/p/7590973.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/391291.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

c++飞扬的小鸟游戏_通过建立一个飞扬的鸟游戏来学习从头开始

c飞扬的小鸟游戏Learn how to use Scratch 3.0 by building a flappy bird game in this course developed by Warfame. Scratch is a free programming language and online community where you can create your own interactive stories, games, and animations. Scratch is…

345

345 转载于:https://www.cnblogs.com/Forever77/p/11512701.html

简·雅各布斯指数第二部分:测试

In Part I, I took you through the data gathering and compilation required to rank Census tracts by the four features identified by Jane Jacobs as the foundation of a great neighborhood:在第一部分中 &#xff0c;我带您完成了根据简雅各布斯(Jacobs Jacobs)所确定…

Docker 入门(3)Docke的安装和基本配置

1. Docker Linux下的安装 1.1 Docker Engine 的版本 社区版 ( CE, Community Edition ) 社区版 ( Docker Engine CE ) 主要提供了 Docker 中的容器管理等基础功能&#xff0c;主要针对开发者和小型团队进行开发和试验企业版 ( EE, Enterprise Edition ) 企业版 ( Docker Engi…

python:单元测试框架pytest的一个简单例子

之前一般做自动化测试用的是unitest框架&#xff0c;发现pytest同样不错&#xff0c;写一个例子感受一下 test_sample.py import cx_Oracle import config from send_message import send_message from insert_cainiao_oracle import insert_cainiao_oracledef test_cainiao_mo…

mkdir命令使用范例

mkdir -p dir1/dir2/dir3/dir4 :-p 创建不存在的中间目录mkdir -m 000 demdir &#xff1a;-m 000 为新创建的目录指定权限转载于:https://blog.51cto.com/2685141/2068162

pwa 问题_您真的需要PWA吗? 这里有四个问题可以帮助您做出决定。

pwa 问题为什么需要PWA并不成问题。 让我们看看为什么您可能不需要它 (Why you need a PWA is not in question. Let’s see why you may NOT need it) My inbox has been filled with questions regarding PWAs after my last two articles. 在上两篇文章之后&#xff0c;我的…

利用ssh反向代理以及autossh实现从外网连接内网服务器

http://www.cnblogs.com/kwongtai/p/6903420.html转载于:https://www.cnblogs.com/littlehb/p/7598037.html

抑郁症损伤神经细胞吗_使用神经网络探索COVID-19与抑郁症之间的联系

抑郁症损伤神经细胞吗The drastic changes in our lifestyles coupled with restrictions, quarantines, and social distancing measures introduced to combat the corona virus outbreak have lead to an alarming rise in mental health issues all over the world. Social…

倦怠和枯燥_如何不断学习(不倦怠)

倦怠和枯燥In tech, constantly learning (both in and out of work) is an unstated job requirement. 在科技界&#xff0c;不断学习(工作中和工作中)是一项未阐明的工作要求。 When I was growing up, I would go to the bookstore with my dad every weekend, and every t…

Xcode 9.0 新增功能大全

Xcode是用于为Apple TV&#xff0c;Apple Watch&#xff0c;iPad&#xff0c;iPhone和Mac创建应用程序的完整开发人员工具集。Xcode开发环境采用tvOS SDK&#xff0c;watchOS SDK&#xff0c;iOS SDK和macOS SDK的形式捆绑Instruments分析工具&#xff0c;Simulator和OS框架。 …

Docker 入门(4)镜像与容器

1. 镜像与容器 1.1 镜像 Docker镜像类似于未运行的exe应用程序&#xff0c;或者停止运行的VM。当使用docker run命令基于镜像启动容器时&#xff0c;容器应用便能为外部提供服务。 镜像实际上就是这个用来为容器进程提供隔离后执行环境的文件系统。我们也称之为根文件系统&a…

python:pytest中的setup和teardown

原文&#xff1a;https://www.cnblogs.com/peiminer/p/9376352.html  之前我写的unittest的setup和teardown&#xff0c;还有setupClass和teardownClass&#xff08;需要配合classmethod装饰器一起使用&#xff09;&#xff0c;接下来就介绍pytest的类似于这类的固件。 &#…

如何开始使用任何类型的数据? - 第1部分

从数据开始 (START WITH DATA) My data science journey began with a student job in the Advanced Analytics department of one of the biggest automotive manufacturers in Germany. I was nave and still doing my masters.我的数据科学之旅从在德国最大的汽车制造商之一…

iHealth基于Docker的DevOps CI/CD实践

本文由1月31日晚iHealth运维技术负责人郭拓在Rancher官方技术交流群内所做分享的内容整理而成&#xff0c;分享了iHealth从最初的服务器端直接部署&#xff0c;到现在实现全自动CI/CD的实践经验。作者简介郭拓&#xff0c;北京爱和健康科技有限公司&#xff08;iHealth)。负责公…

从早期的初创企业到MongoDB的经理(播客)

In this weeks podcast episode, I chat with Harry Wolff, an engineering manager at MongoDB in New York City. Harry has been in the world of tech for over a decade, holding jobs in various startups before ending up at Mongo. 在本周的播客节目中&#xff0c;我与…

leetcode 1011. 在 D 天内送达包裹的能力(二分法)

传送带上的包裹必须在 D 天内从一个港口运送到另一个港口。 传送带上的第 i 个包裹的重量为 weights[i]。每一天&#xff0c;我们都会按给出重量的顺序往传送带上装载包裹。我们装载的重量不会超过船的最大运载重量。 返回能在 D 天内将传送带上的所有包裹送达的船的最低运载…

python:pytest优秀博客

上海悠悠&#xff1a;https://www.cnblogs.com/yoyoketang/tag/pytest/ 转载于:https://www.cnblogs.com/gcgc/p/11514345.html

uva 11210

https://uva.onlinejudge.org/index.php?optioncom_onlinejudge&Itemid8&pageshow_problem&problem2151 题意&#xff1a;给你十三张麻将&#xff0c;问你需要哪几张牌就可以胡牌&#xff0c;这个胡牌排除了七小对以及十三幺 胡牌必须要有一个对子加&#xff4e;个…

机器学习图像源代码_使用带有代码的机器学习进行快速房地产图像分类

机器学习图像源代码RoomNet is a very lightweight (700 KB) and fast Convolutional Neural Net to classify pictures of different rooms of a house/apartment with 88.9 % validation accuracy over 1839 images. I have written this in python and TensorFlow.RoomNet是…