ssm

SSM新征程-第一个SSM

寵の児 提交于 2019-12-01 01:37:02
第一个 SSM 框架下的网页应用 SSM 指 Spring + SpringMVC + Mybatis 整合一起进行网页开发的当下流行框架, Spring 的核心是自动注入(反转控制)和切面编程,简单来说自动注入就是本来需要自己 new 对象,但是在 spring 下,它可以根据你的配置自动为你创建对象,配置方式有两种,一是 xml 文件配置,另一种是注解方式,简单方便。在初学过程中学习 xml 文件配置可以很好理解 Spring 的原理。切面编程可以很好的把应用的主要事务和周边事务分离开来,周边事务指的是日志之类的东西。怎么使用 Spring 呢?首先在一个测试类里利用 ApplicationContext.xml 文件生成一个 ApplicationContext 容器对象 , ApplicationContext.xml 文件里包含着 Spring 容器的配置信息。生成了容器之后就可以利用 getBean 方法获取对象了!这就是 Spring 的简单使用方法 SpringMVC 是众多 MVC 模式下的流行的开发模式之一,和平时最基本的 Servlet 方式开发的配置文件的区别是多了一个 SpringMVC.xml,SpringMVC 的 web.xml 配置文件只有一个 <servlet> 的解释,告诉 tomcat 所有的请求都提交到 dispatcher-Servlet

纯后端SSM框架(spring+springboot+mybatis)下实现CRUD 小白练手

我与影子孤独终老i 提交于 2019-12-01 01:22:51
更新: Mybatis允许增删改查直接定义以下类型的返回值:Integer、Long、Boolean、void。(这些类型的包装类或基本类型都可以) 比如:用boolean,如果影响行数超过0行以上,就可以返回true;0行就返回false。 只要在接口返回方法上定义就行,无需在sql映射文件中写返回值类型,而且也写不了。 在springboot中实现,先介绍一下实现该项目的需要的几个文件: 1、Java文件夹: bean层:entity包下的 Student.java 文件(存放具体的java对象,用来映射数据库的字段的,是简单的pojo) service层:service包下的 StudentService.java 接口文件(业务逻辑接口,写业务逻辑用的) service.imp包下的 StudentServiceImpl.java 接口实现类文件(实现业务接口,一般事务控制写在这里) dao层:dao包下的 StudentDao.java 接口文件(数据访问层接口,与数据打交道,可以是数据库操作,也可以是文件读写操作,甚至是redis缓存操作,也有人称数据持久层) controller层:controller包下的 StudentController.java 文件(控制层,也叫web控制器,springmvc在这里发挥作用) 2、resources文件夹: dao层

springboot整合ssm详细讲解

末鹿安然 提交于 2019-12-01 01:20:11
SSM是企业中广泛应用的框架。大家再熟练地使用SSM进行业务逻辑开发的时候,也被它大量的xml配置困扰。今 天快速优雅的使用SpringBoot实现简易的SSM工程。废话不多说,come on 开发工具idea 1.创建一个web工程,pom.xml中加入如下配置: <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.10.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework

Spring Boot整合SSM

大憨熊 提交于 2019-12-01 01:19:33
Spring Boot可以帮助我们快速的搭建一个SSM框架,那建立spring boot项目之后怎样和SSM整合呢? 1.新建Model时,选择项目需要的核心依赖包 2.新建项目,建立相关对应的核心包,下图是成功之后的项目结构图 Students.java package com . ssm . springboot02 . model ; /** * @author 小思 * @PackageName:com.ssm.springboot02.model * @ClassName: Students * @Description: * @date 2018/11/20 12:01 */ public class Students { private Integer sid ; private String sname ; public Integer getSid ( ) { return sid ; } public void setSid ( Integer sid ) { this . sid = sid ; } public String getSname ( ) { return sname ; } public void setSname ( String sname ) { this . sname = sname ; } public Students (

SpringBoot 集成SSM(spring+springmvc+mabatis)

非 Y 不嫁゛ 提交于 2019-12-01 01:18:28
SpringBoot 集成 SSM ( spring+springmvc+mabatis ) 1. 前言 该 SpringBoot集成 SSM 的例子基于 elipse 环境开发, JDK 版本为 1.8 , tomcat 为 Springboot 自带的容器。 2. 开发环境 操作系统: window10 开发工具: eclipse ( eclipse-jee-oxygen-3a-win32-x86_64 , eclipse_2018 ) 服务器: springboot 自带的 tomcat 容器 插件: maven 插件(可以自行配置,也可以直接使用 springboot 内置的 maven 插件) 3. 集成 SSM 操作步骤 3.1 创建基于 maven 的 web 项目 3.1.1. 新建一个 maven-web 项目 3.1.2 填入 GroupID 和 ArtifactID 即可 GroupID 是项目组织唯一的标识符,实际对应 JAVA 的包的结构,是 main 目录里 java 的目录结构。(例: com.ypf.cn ) ArtifactID 就是项目的唯一的标识符,实际对应项目的名称,就是项目根目录的名称。(例: my_springboot_ssm ) 3.1.3 创建后出错的的解决办法(若无错也可以通过此方法查看项目搭建后的环境是否正确) 通过

idea2019搭建ssm(spring+springMVC+mybatis)项目

ⅰ亾dé卋堺 提交于 2019-12-01 00:14:42
1.新建项目 2.在项目根目录新建Directry:target 3.建好项目目录: 4.引入相关依赖 5.定义实体domain 6.定义对应dao接口 7.配置mapper.xml文件 8.新建三个spring-xx.xml文件 spring-dao.xml:(spring-mybatis整合配置文件) <?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/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/contex

IDEA使用(3 springboot 整合SSM框架)

一曲冷凌霜 提交于 2019-11-30 23:54:48
pom.xml <? xml version ="1.0" encoding ="UTF-8" ?> <project xmlns ="http://maven.apache.org/POM/4.0.0" xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance" xsi :schemaLocation ="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelVersion> 4.0.0 </modelVersion> <groupId> com.example </groupId> <artifactId> demo </artifactId> <version> 1 </version> <packaging> jar </packaging> <name> demo </name> <description> Demo project for Spring Boot </description> <parent> <groupId> org.springframework.boot </groupId> <artifactId> spring-boot-starter-parent <

Springboot快速搭建SSM框架

假装没事ソ 提交于 2019-11-30 23:53:23
Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。通过这种方式,Spring Boot致力于在蓬勃发展的快速应用开发领域(rapid application development)成为领导者。 本文使用的开发工具为Idea2017、tomcat8.0、Java1.8、mysql5.6、maven3.5.3 源码: https://github.com/gdhzlee/springbootssmtest 一、新建Java web项目 (一)通过maven模板搭建Java web项目。 (二)构建Java web项目架构 1、通过maven模板新建好项目后,我们发现当前的项目架构还不完整。 2、需要通过手动添加一些必要的package。 注意:每个包的颜色和标志是不同的。 例如,java包存放的是源码,类型为Source root;resource存放的是资源,类型为Resource root 可以通过对包右键,Mark Directory As,进行设置。 3、Mark Directory As 这个配置,主要是为了部门告诉tomcat那些是源码目录,那些是资源。 一、Source roots (or source folders)

SSM相关知识

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 18:43:41
1.SpringMVC的工作流程? 1. 用户发送请求至前端控制器DispatcherServlet 2. DispatcherServlet收到请求调用HandlerMapping处理器映射器。 3. 处理器映射器根据请求url找到具体的处理器,生成处理器对象及处理器拦截器(如果有则生成)一并返回给DispatcherServlet。 4. DispatcherServlet通过HandlerAdapter处理器适配器调用处理器 5. 执行处理器(Controller,也叫后端控制器)。 6. Controller执行完成返回ModelAndView 7. HandlerAdapter将controller执行结果ModelAndView返回给DispatcherServlet 8. DispatcherServlet将ModelAndView传给ViewReslover视图解析器 9. ViewReslover解析后返回具体View 10. DispatcherServlet对View进行渲染视图(即将模型数据填充至视图中)。 11. DispatcherServlet响应用户 2.Spring在SSM起什么作用? Spring是一个轻量级框架,也是一个容器,Spring实质上讲就是一个Bean工厂,主要用来管理Bean的生命周期和框架集成。有IOC控制反转,DI依赖注入

ssm整合常见错误

不想你离开。 提交于 2019-11-30 18:38:20
(1) <form action="/account/save" method="post"> 名字 <input type="text" name="name"><br> 金额 <input type="text" name="menoy"><br> <input type="button" value="保存"> <br> </form> <form action="account/save" method="post"> 姓名:<input type="text" name="name" /><br/> 金额:<input type="text" name="menoy" /><br/> <input type="submit" value="保存"/><br/> </form> *表单 action属性路径错误 "/account/save" "account/save" *错误提示:点击提交按钮无响应 (2)sql语句出错: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: 500内部错误 (3)spring与mybatis整合路径错误 Error creating bean with name 'accountService':