这是我写的第二个SSM完整的小项目,是一个优秀电影推荐推荐系统,分享出来供大家交流分享。

文章目录

  • 项目结构目录
  • 项目主要运行截图
  • 项目的主要配置文件(类似于上一个SSM项目)
  • 项目核心类
  • 演示结果
项目结构目录

项目主要运行截图

项目的主页面

信息展示页面(所有电影显示列表)

增加优秀电影页面

查看优秀电影页面

修改优秀电影页面

删除优秀电影

项目的主要配置文件(类似于上一个SSM项目)

spring-dao数据库持久层配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beanshttps://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttps://www.springframework.org/schema/context/spring-context.xsd"><!--1、关联数据库文件--><context:property-placeholder location="classpath:database.properties"/><!--2、连接池--><!--C3p0:自动化操作(自动化的加载配置文件,并且可以自动设置到对象中)jdbc:半自动化操作,不能自动连接druid:hikari:--><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"><property name="driverClass" value="${driver}"/><property name="jdbcUrl" value="${url}"/><property name="user" value="${user}"/><property name="password" value="${password}"/><!--c3p0的私有属性--><property name="maxPoolSize" value="30"/><property name="minPoolSize" value="10"/><!--关闭连接后不能自动连接commit--><property name="autoCommitOnClose" value="false"/><!--获取连接超时时间,10秒--><property name="checkoutTimeout" value="10000"/><!--当前获取连接失败的次数--><property name="acquireRetryAttempts" value="2"/></bean><!-- 3.配置SqlSessionFactory对象 --><bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><!-- 注入数据库连接池 --><property name="dataSource" ref="dataSource"/><!-- 配置MyBaties全局配置文件:mybatis-config.xml --><property name="configLocation" value="classpath:mybatis-config.xml"/><!-- 扫描pojo包 使用别名 --><property name="typeAliasesPackage" value="com.mengxiaoyu.pojo"/><!-- 扫描sql配置文件:mapper需要的xml文件 --><property name="mapperLocations" value="classpath:mapper/*.xml"/></bean><!-- 4.配置扫描Dao接口包,动态实现Dao接口,注入到spring容器中 --><bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"><!-- 注入sqlSessionFactory --><property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/><!-- 给出需要扫描Dao接口包 --><property name="basePackage" value="com.mengxiaoyu.dao"/></bean></beans>

spring-mvc层配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:mvc="http://www.springframework.org/schema/mvc"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beanshttps://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsdhttp://www.springframework.org/schema/contexthttps://www.springframework.org/schema/context/spring-context.xsd"><!--1、注解驱动--><mvc:annotation-driven/><!--2、静态资源过滤器--><mvc:default-servlet-handler/><!-- 3、扫描包:controller --><context:component-scan base-package="com.mengxiaoyu.controller"/><!-- 4、视图解析器  --><bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"><!--前缀--><property name="prefix" value="/WEB-INF/pages/"/><!--后缀--><property name="suffix" value=".jsp"/></bean></beans>

spring-service业务层配置

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx.xsd"><!-- 扫描service包下所有使用注解的类型 --><context:component-scan base-package="com.mengxiaoyu.service" /><!-- 配置事务管理器 --><bean id="transactionManager"class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><!-- 注入数据库连接池 --><property name="dataSource" ref="dataSource" /></bean><!-- 配置基于注解的声明式事务 --><tx:annotation-driven transaction-manager="transactionManager" />
</beans>
项目核心类

FilmController控制跳转类

package com.mengxiaoyu.controller;import com.mengxiaoyu.pojo.Film;
import com.mengxiaoyu.service.FilmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;import java.util.List;
import java.util.Map;@RequestMapping("filmController")
@Controller
public class FilmController {@Autowiredprivate FilmService filmService;@RequestMapping("getAllFilm")public String getAllFilm(Map<String, List<Film>> map) {List<Film> films = filmService.queryAllFilm();map.put("films", films);return "homePage";}@ResponseBody@RequestMapping("addFilm")public String addFilm(Film film) {//加入数据库,看返回值决定是否成功int i = filmService.addFilm(film);if (i > 0) {return "success";} else {return "error";}}@ResponseBody@RequestMapping("deleteFilmById")public String deleteFilmById(int id) {int i = filmService.deleteFilmById(id);if (i > 0) {return "success";} else {return "error";}}@ResponseBody@RequestMapping("updateFilm")public String updateFilm(Film film) {//加入数据库,看返回值决定是否成功int i = filmService.updateFilm(film);if (i > 0) {return "success";} else {return "error";}}}

FilmDao类的映射文件FilmMapper.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- namespace:该mapper.xml映射文件的唯一标识 -->
<mapper namespace="com.mengxiaoyu.dao.FilmDao"><select id="queryFilmById" parameterType="int" resultType="Film">select * from film where id = #{id}</select><select id="queryAllFilm" resultType="Film">select * from film</select><insert id="addFilm" parameterType="Film">insert into film(name,director,actor,date,nation,grade) values (#{name}, #{director}, #{actor}, #{date}, #{nation}, #{grade})</insert><delete id="deleteFilmById" parameterType="int">delete from film where id = #{id}</delete><update id="updateFilm" parameterType="Film">update film set name = #{name}, director = #{director}, actor = #{actor}, date = #{date}, nation = #{nation}, grade = #{grade} where id = #{id}</update>
</mapper>

更多源代码请去我的github下载源项目

演示结果

[SSM完整项目]仿豆瓣优秀电影评分系统相关推荐

  1. ssm毕设项目基于的少儿编程学习系统2lsiy(java+VUE+Mybatis+Maven+Mysql+sprnig)

    ssm毕设项目基于的少儿编程学习系统2lsiy(java+VUE+Mybatis+Maven+Mysql+sprnig) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + ...

  2. 小米电视自带app内的电影评分系统

    自家用的小米电视, 小米电视内自带app内的电影评分系统,战狼2的评分只给7点几,一个垃圾渣渣新演员演的超级烂片给8点几的评分,还不让给差评,没有评论入口,小米官方论坛直接关闭发贴接口,你们这群傻逼要 ...

  3. SSM毕设项目场景理论下城镇消费信贷系统l831r(java+VUE+Mybatis+Maven+Mysql)

    SSM毕设项目场景理论下城镇消费信贷系统l831r(java+VUE+Mybatis+Maven+Mysql) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBui ...

  4. SSM毕设项目基于web的在线订餐系统sbh8k(java+VUE+Mybatis+Maven+Mysql)

    SSM毕设项目基于web的在线订餐系统sbh8k(java+VUE+Mybatis+Maven+Mysql) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuil ...

  5. ssm毕设项目基于框架的中医养生系统i9830(java+VUE+Mybatis+Maven+Mysql+sprnig)(1)

    ssm毕设项目基于框架的中医养生系统i9830(java+VUE+Mybatis+Maven+Mysql+sprnig)(1) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysq ...

  6. java ssm项目经验描述_第一个SSM完整项目开发心得

    博主因为打算要考研,所以为了给自己留一手后路.学习了SSM框架.这学期就做了一个完整的SSM项目.(如果考研失败就去外包做一波CRUD boy) 所以边考研边利用业余时间做了一学期,接着期末一周的We ...

  7. SSM 完整项目 (内含源码)

    SSM 电影后台管理项目 概述 通过对数据库中一张表的CRUD,将相应的操作结果渲染到页面上. 笔者通过这篇博客还原了项目(当然有一些隐藏的坑),然后将该项目上传到了Github.Gitee,在末尾会 ...

  8. vue实战项目仿卖座电影APP

    所用到技术栈:vue-cli,vue-router,vuex,swiper,batter-scroll,axios,mint-ui,stylus,es6以及百度地图API 下面页面是项目效果页面 项目 ...

  9. 【电影评分算法】豆瓣、猫眼、IMDb

    豆瓣评分:   评分对象--豆瓣注册用户(注册比较久的老用户评分才有作用,新用户的评分仅作参考)且不是"非正常打分"的帐号:   规则--一人一票,一星至五星,最后换算成10分制: ...

最新文章

  1. 即将 50 岁的雷军,重新回到手机战场
  2. The Innovation | Call for Youth Editors 青年编委招募
  3. android:layout_gravity=bottom不起作用问题
  4. Android开发--Matrix(二)--实现图片的旋转
  5. 【转】Android检查手机是否被root
  6. 在线教育流量洪峰最佳实践
  7. crontab清理日志
  8. SAP Spartacus的navigation初始化
  9. SharePoint 2007 and 2010 的服务器场的端口
  10. 【Office Word】论文排版有关技巧
  11. 【转】Java垃圾收集器
  12. 想打造一款成功的移动应用?你最需要关注性能指标!
  13. 为什么grab显示无法定位_西门子SIPARTPS2阀门定位器的故障处理
  14. 计算机平面设计主要学什么,学习平面设计都有哪些课程?
  15. html5打印样式没有加载,cad打印样式不见了(cad没有打印样式表)
  16. base64编码以及b' '前缀的去除
  17. 手淘双十一性能优化项目揭秘
  18. Latex报错(TexWork):Misplaced alignment tab character . l.13 Journal of Hygiene
  19. unity 谷歌广告介入_Unity为开发人员发布Google广告
  20. 疫情下的企业应对之道:企业如何降本提质增效

热门文章

  1. GIS编程:利用Arcpy实现道格拉斯-普克算法(核心代码已用类包装,复制粘贴即可用)
  2. 斧子演示_用斧头进行自动辅助功能检查
  3. java.net.SocketTimeoutException: Read timed out异常解决方法
  4. docker 运行应用程序出现 “no main manifest attribute, in /XXXX.jar” 原因
  5. 2017年高教社杯全国大学生数学建模竞赛题目 B题 “拍照赚钱”的任务定价
  6. javafx去掉stage的任务栏图标
  7. 腾讯cos 上传php实例,tp5 接入腾讯对象存储COS
  8. 信息化项目投标不知道准备哪些证书?看这篇就够了!
  9. 纯滞后系统的数字Smith预估控制-2
  10. 实战游戏项目管理3-执行篇