SSM框架整合

今天来整合一下SSM三大框架~~

1、创建一个maven项目

比较简单就不赘述了,创建的时候选择webapp骨架。

用骨架创建的项目,在创建完之后要更新一下web.xml
模板目录:“你的Tomcat安装目录\webapps\ROOT\WEB-INF\web.xml”

2、项目整体结构

按照以下项目目录创建好项目的结构
在这里插入图片描述

3、导入依赖

<dependencies>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.29</version>
    </dependency>
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>3.5.10</version>
    </dependency>
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis-spring</artifactId>
      <version>2.0.7</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>5.0.2.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>5.0.2.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aop</artifactId>
      <version>5.0.2.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
      <version>5.0.2.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.18.24</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
    </dependency>
    <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>druid</artifactId>
      <version>1.2.11</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>jstl</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
  </dependencies>
<!--在build中加入如下代码,解决java文件夹下的xml文件加载不进来-->
<build>
    <resources>
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
        </includes>
      </resource>
    </resources>
  </build>

4、创建数据库表

/*
SQLyog Ultimate v12.09 (64 bit)
MySQL - 8.0.29 : Database - mybatis
*********************************************************************
*/

/*!40101 SET NAMES utf8 */;

/*!40101 SET SQL_MODE=''*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`mybatis` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;

USE `mybatis`;

/*Table structure for table `blog` */

DROP TABLE IF EXISTS `blog`;

CREATE TABLE `blog` (
  `id` int NOT NULL AUTO_INCREMENT,
  `title` varchar(45) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `author` varchar(45) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  `views` int DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1012 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

/*Data for the table `blog` */

insert  into `blog`(`id`,`title`,`author`,`create_time`,`views`) values (1001,'java','寅子','2022-08-27 22:21:10',9999),(1002,'python','寅子','2022-08-27 22:22:07',9999),(1003,'c++','寅子','2022-08-27 22:22:37',9999),(1004,'c','寅子','2022-08-27 22:23:17',1000);

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

5、创建pojo实体类

package com.yinzi.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Blog implements Serializable {
    private int id;
    private String title;
    private String author;
    private Date createTime;
    private int views;
}

=============== 整合Mybatis ==============

6、编写mybatis配置文件:mybatis-config.xml

在mybatis-config中我们只配置基本的几个属性,剩下的有spring创建

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <settings>
        <setting name="mapUnderscoreToCamelCase" value="true"/>
        <setting name="logImpl" value="LOG4J"/>
    </settings>
    <typeAliases>
        <package name="com.yinzi.pojo"/>
    </typeAliases>
</configuration>

加入log4j日志配置

# Set root category priority to INFO and its only appender to CONSOLE.
#log4j.rootCategory=INFO, CONSOLE            debug   info   warn error fatal
log4j.rootCategory=debug, CONSOLE, LOGFILE

# Set the enterprise logger category to FATAL and its only appender to CONSOLE.
log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE

# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m\n

# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=d:\axis.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m\n

7、创建Spring整合mybatis的配置文件:spring-mybatis.xml

此配置主要用来整合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"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       https://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/mvc
       https://www.springframework.org/schema/mvc/spring-mvc.xsd">



    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
        <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://localhost:3306/mybatis?useSSL=true&amp;useUnicode=true&amp;characterEncoding=utf8"/>
        <property name="username" value="root"/>
        <property name="password" value="123456"/>
    </bean>

    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="configLocation" value="classpath:mybatis-config.xml"/>
    </bean>

    <bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
        <constructor-arg index="0" ref="sqlSessionFactory"/>
    </bean>

    <bean id="mapperScanner" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="com.yinzi.dao"/>
    </bean>
</beans>

8、创建dao中的BlogMapper接口和BlogMapper.xml

BlogMapper

package com.yinzi.dao;

import com.yinzi.pojo.Blog;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface BlogMapper {
    List<Blog> findAll();

    Blog findById(@Param("id") int id);

    List<Blog> findByTitle(@Param("title") String title);

    int add(Blog blog);

    int update(Blog blog);

    int delete(@Param("id") int id);

}

BlogMapper.xml

<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yinzi.dao.BlogMapper">
    <cache/>
    <select id="findAll" resultType="blog">
        select * from blog;
    </select>

    <select id="findById" parameterType="int" resultType="blog">
        select * from blog where id = #{id};
    </select>

    <select id="findByTitle" parameterType="String" resultType="blog">
        select * from blog
        <where>
            title like "%" #{title} "%";
        </where>
    </select>

    <insert id="add" parameterType="blog">
        insert into blog(title,author,create_time,views)
        values (#{title},#{author},#{createTime},#{views});
    </insert>

    <update id="update" parameterType="blog">
        update blog set title=#{title},author=#{author},create_time=#{createTime},views=#{views}
        where id = #{id};
    </update>

    <delete id="delete" parameterType="int">
        delete from blog where id = #{id};
    </delete>
</mapper>

9、创建service中的BlogService接口和BlogServiceImpl实现类

BlogService

package com.yinzi.service;

import com.yinzi.pojo.Blog;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface BlogService {
    List<Blog> findAll();

    Blog findById(int id);

    List<Blog> findByTitle(String title);

    int add(Blog blog);

    int update(Blog blog);

    int delete(int id);
}

BlogServiceImpl

package com.yinzi.service.impl;

import com.yinzi.dao.BlogMapper;
import com.yinzi.pojo.Blog;
import com.yinzi.service.BlogService;

import java.util.List;

public class BlogServiceImpl implements BlogService {

    private BlogMapper blogMapper;

    public void setBlogMapper(BlogMapper blogMapper) {
        this.blogMapper = blogMapper;
    }

    @Override
    public List<Blog> findAll() {
        return blogMapper.findAll();
    }

    @Override
    public Blog findById(int id) {
        return blogMapper.findById(id);
    }

    @Override
    public List<Blog> findByTitle(String title) {
        return blogMapper.findByTitle(title);
    }

    @Override
    public int add(Blog blog) {
        return blogMapper.add(blog);
    }

    @Override
    public int update(Blog blog) {
        return blogMapper.update(blog);
    }

    @Override
    public int delete(int id) {
        return blogMapper.delete(id);
    }
}

10、创建Spring总的配置文件SpringContext.xml

<?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:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       https://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/mvc
       https://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <import resource="classpath:spring-mybatis.xml"/>
    <import resource="classpath:spring-mvc.xml"/>

    <bean id="blogService" class="com.yinzi.service.impl.BlogServiceImpl">
        <property name="blogMapper" ref="blogMapper"/>
    </bean>

</beans>

这里的spring-mvc.xml时候springmvc的配置文件,防止这里爆红,可以先创建好,后面再进行编写

== 写到这里可以去测试一下项目的能不能运行起来 ==
创建一个Text测试类

import com.yinzi.pojo.Blog;
import com.yinzi.service.BlogService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class MyTest {

    @Test
    public void test1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        BlogService blogService = context.getBean("blogService", BlogService.class);
        List<Blog> blogList = blogService.findAll();
        for (Blog blog : blogList) {
            System.out.println(blog);
        }
    }
}

如果以上配置没有错误,将得到一下输出,证明项目没有问题~
在这里插入图片描述

============ 整合SpringMVC =============

11、编写web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
         http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1"
         metadata-complete="true">

    <servlet>
        <servlet-name>springmvc</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:applicationContext.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>springmvc</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <filter>
        <filter-name>characterEncoding</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>utf-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>characterEncoding</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>HiddenHttpMethodFilter</filter-name>
        <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>HiddenHttpMethodFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

12、创建spring-mvc.xml配置文件

<?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:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       https://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/mvc
       https://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <context:component-scan base-package="com.yinzi">
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>

    <bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/pages/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

    <mvc:default-servlet-handler/>

    <mvc:annotation-driven/>
    
</beans>

13、创建BlogController

package com.yinzi.controller;

import com.yinzi.pojo.Blog;
import com.yinzi.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@Controller
public class BlogController {

    @Autowired
    @Qualifier("blogService")
    private BlogService blogService;

    // 查询所有blog
    @GetMapping("/blog")
    public String findAll(Model model){
        List<Blog> blogList = blogService.findAll();
        model.addAttribute("blogList",blogList);
        return "blog";
    }

    // 跳转添加页面
    @RequestMapping("/toAdd")
    public String toAdd(){
        return "add";
    }
    // 添加blog
    @PostMapping("/blog")
    public String add(Blog blog){

        blog.setCreateTime(new Date());
        int add = blogService.add(blog);

        return "redirect:/blog";
    }

    @DeleteMapping("/blog/{id}")
    public String delete(@PathVariable int id){
        int delete = blogService.delete(id);
        return "redirect:/blog";
    }

    // 跳转修改页面
    @RequestMapping("/toUpdate/{id}")
    public String toUpdate(@PathVariable int id,Model model){
        Blog blog = blogService.findById(id);
        model.addAttribute("blog",blog);
        return "update";
    }

    // 修改blog
    @PutMapping("/blog")
    public String update(Blog blog){
        blog.setCreateTime(new Date());
        int update = blogService.update(blog);
        return "redirect:/blog";
    }

    // 根据名字查询blog
    @RequestMapping("/search")
    public String search(String title,Model model){
        List<Blog> blogList = blogService.findByTitle(title);
        model.addAttribute("blogList",blogList);
        return "blog";
    }
}

14、创建页面文件

分别在WEB-INF/pages/下创建一下jsp
blog.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha512-SfTiTlX6kk+qitfevl/7LibUOeJWlt9rbyDn92a1DqWOw9vWG2MFoays0sgObmWazO5BQPiFucnnEAjpAB+/Sw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>

<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>博客列表 —— 显示所有博客</small>
                </h1>
            </div>
        </div>
    </div>
    <div class="row">
        <form action="${pageContext.request.contextPath}/search" method="post" class="form-inline">
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/toAdd">新增</a>
            <div class="form-group">
                <label class="sr-only" for="exampleInputAmount">输入您想搜索的内容</label>
                <div class="input-group">
                    <input name="title" type="text" class="form-control" id="exampleInputAmount" placeholder="Amount">
                    <div class="input-group-btn">
                        <button class="btn btn-default" type="submit" style="height: 34px">
                            <i class="fa fa-search"></i>
                        </button>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">
                <thead>
                <tr>
                    <th>博客编号</th>
                    <th>博客标题</th>
                    <th>作者</th>
                    <th>创建时间</th>
                    <th>浏览量</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="blogList" items="${blogList}">
                    <tr>
                        <td>${blogList.id}</td>
                        <td>${blogList.title}</td>
                        <td>${blogList.author}</td>
                        <td>${blogList.createTime}</td>
                        <td>${blogList.views}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/toUpdate/${blogList.id}" style="text-decoration: none">
                                <button class="btn btn-primary">更改</button>
                            </a>
                            <form action="${pageContext.request.contextPath}/blog/${blogList.id}" method="post"
                                  style="display: inline">
                                <input type="hidden" name="_method" value="delete">
                                <input class="btn btn-danger" type="submit" value="删除">
                            </form>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
</div>
</body>
</html>

add.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>新增博客</small>
                </h1>
            </div>
        </div>
    </div>
    <form action="${pageContext.request.contextPath}/blog" class="form-horizontal" method="post">
        <div class="form-group">
            <label for="title" class="col-sm-2 control-label">Title</label>
            <div class="col-sm-10">
                <input type="text" name="title" class="form-control" id="title" placeholder="Title">
            </div>
        </div>
        <div class="form-group">
            <label for="author" class="col-sm-2 control-label">author</label>
            <div class="col-sm-10">
                <input type="text" name="author" class="form-control" id="author" placeholder="author">
            </div>
        </div>
        <div class="form-group">
            <label for="views" class="col-sm-2 control-label">views</label>
            <div class="col-sm-10">
                <input type="text" name="views" class="form-control" id="views" placeholder="views">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary">add</button>
            </div>
        </div>
    </form>
</div>
</body>
</html>

update.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改博客</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>修改博客</small>
                </h1>
            </div>
        </div>
    </div>

    <form action="${pageContext.request.contextPath}/blog" class="form-horizontal" method="post">
        <input type="hidden" name="_method" value="put">
        <input type="hidden" name="id" value="${blog.id}">
        <div class="form-group">
            <label for="title" class="col-sm-2 control-label">Title</label>
            <div class="col-sm-10">
                <input type="text" name="title" class="form-control" id="title" placeholder="Title" value="${blog.title}">
            </div>
        </div>
        <div class="form-group">
            <label for="author" class="col-sm-2 control-label">author</label>
            <div class="col-sm-10">
                <input type="text" name="author" class="form-control" id="author" placeholder="author" value="${blog.author}">
            </div>
        </div>
        <div class="form-group">
            <label for="views" class="col-sm-2 control-label">views</label>
            <div class="col-sm-10">
                <input type="text" name="views" class="form-control" id="views" placeholder="views" value="${blog.views}">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary">update</button>
            </div>
        </div>
    </form>
</div>
</body>
</html>

15、运行界面

主界面
在这里插入图片描述
添加界面
在这里插入图片描述
修改界面
在这里插入图片描述
到此,SSM框架就整合完成了~

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值