简略SSM整合

it2023-12-18  67

文章目录

一、Spring-SpringMVC-MyBatis整合SSM创建数据库添加pom.xml依赖配置mybatis-config.xml配置database.properties创建实体类创建dao接口或mapper接口创建dao接口或mapper接口.xml创建service接口创建service接口实现类配置spring-dao.xml配置spring-mvc.xml配置spring-service.xml配置applicationContext.xml配置web/WEB-INF下的web.xml创建controller类jsp相关页面index.jspalldog.jspaddDog.jspupdateDog.jsp


一、Spring-SpringMVC-MyBatis整合SSM

这里我并没有按照正常顺序编写,尽量还是按照正常顺序为好.

创建数据库

创建表完成后,随机添加几条数据

CREATE TABLE `dog` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '序号', `name` varchar(50) DEFAULT NULL COMMENT '名字', `health` int(11) DEFAULT NULL COMMENT '健康值', `love` int(11) DEFAULT NULL COMMENT '亲密度', `strain` varchar(50) DEFAULT NULL COMMENT '品种', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8

创建web项目

添加pom.xml依赖

<!-- 依赖: junit,数据库连接,连接池,servlet,jsp,mybatis,mybatis-spring,spring --> <dependencies> <!-- junit--> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> <!-- 数据库连接--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.38</version> </dependency> <!-- 数据库连接池-c3p0--> <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.5.2</version> </dependency> <!-- servlet-api--> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> </dependency> <!-- jsp-api--> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> </dependency> <!-- jstl--> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <!-- mybatis--> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3.5.5</version> </dependency> <!-- mybatis-spring--> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>2.0.5</version> </dependency> <!-- spring--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>5.2.7.RELEASE</version> </dependency> <!-- spring-jdbc--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>5.2.7.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>5.2.7.RELEASE</version> </dependency> <!-- spring-aop--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>5.2.7.RELEASE</version> </dependency> <!-- 织入--> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.9.5</version> </dependency> </dependencies> <!-- 静态资源导出--> <build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build>

配置mybatis-config.xml

<?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> <!-- 配置数据源由Spring去做--> <!-- 日志--> <settings> <setting name="logImpl" value="STDOUT_LOGGING"/> </settings> <!-- 实体类别名--> <typeAliases> <package name="com.java.ym.entity"/> </typeAliases> <!-- 映射Mapper.xml配置文件--> <mappers> <mapper resource="DogMapper.xml"></mapper> </mappers> </configuration>

配置database.properties

jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8 jdbc.username=root jdbc.password=123

创建实体类

package com.java.ym.entity; /** * @Author: YuMi * @Date: 2020/10/16 10:57 * ---------------------- * @Comments: 实体类 */ public class Dog { private Integer id; private String name; private Integer health; private Integer love; private String strain; public Dog() { } public Dog(Integer id, String name, Integer health, Integer love, String strain) { this.id = id; this.name = name; this.health = health; this.love = love; this.strain = strain; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getHealth() { return health; } public void setHealth(Integer health) { this.health = health; } public Integer getLove() { return love; } public void setLove(Integer love) { this.love = love; } public String getStrain() { return strain; } public void setStrain(String strain) { this.strain = strain; } @Override public String toString() { return "Dog{" + "id=" + id + ", name='" + name + '\'' + ", health=" + health + ", love=" + love + ", strain='" + strain + '\'' + '}'; } }

创建dao接口或mapper接口

package com.java.ym.mapper; import com.java.ym.entity.Dog; import org.apache.ibatis.annotations.Param; import java.util.List; /** * @Author: YuMi * @Date: 2020/10/16 11:04 * ---------------------- * @Comments: dao接口 */ public interface DogMapper { /** * 增加宠物信息 * @param dog * @return */ int addDog(Dog dog); /** * 根据id删除宠物 * @param id * @return */ int deleteDogId(@Param("dogId") int id); /** * 修改宠物信息 * @param dog * @return */ int updateDog(Dog dog); /** * 根据id查询宠物信息 * @param id * @return */ Dog queryDogId(@Param("dogId") int id); /** * 查询全部宠物 * @return */ List<Dog> queryAllDog(); /** * 查询宠物名字 * @param name * @return */ Dog queryDogByName(@Param("dogName") String name); }

创建dao接口或mapper接口.xml

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- 一个Mapper对应一个接口--> <mapper namespace="com.java.ym.mapper.DogMapper"> <insert id="addDog" parameterType="Dog"> INSERT INTO dog(NAME,health,love,strain) VALUES(#{name},#{health},#{love},#{strain}); </insert> <delete id="deleteDogId" parameterType="int"> DELETE FROM dog WHERE id=#{dogId}; </delete> <update id="updateDog" parameterType="Dog"> UPDATE dog SET NAME=#{name},health=#{health},love=#{love},strain=#{strain} WHERE id=#{id}; </update> <select id="queryDogId" resultType="Dog"> SELECT * FROM dog WHERE id=#{dogId}; </select> <select id="queryAllDog" resultType="Dog"> SELECT * FROM dog; </select> <select id="queryDogByName" resultType="Dog"> SELECT * FROM dog WHERE NAME like '%${dogName}%'; </select> </mapper>

创建service接口

package com.java.ym.service; import com.java.ym.entity.Dog; import org.apache.ibatis.annotations.Param; import java.util.List; /** * @Author: YuMi * @Date: 2020/10/16 11:27 * ---------------------- * @Comments: 业务逻辑接口 */ public interface DogService { /** * 增加宠物信息 * @param dog * @return */ int addDog(Dog dog); /** * 根据id删除宠物 * @param id * @return */ int deleteDogId(@Param("dogId") int id); /** * 修改宠物信息 * @param dog * @return */ int updateDog(Dog dog); /** * 根据id查询宠物信息 * @param id * @return */ Dog queryDogId(@Param("dogId") int id); /** * 查询全部宠物 * @return */ List<Dog> queryAllDog(); /** * 查询宠物名字 * @param name * @return */ Dog queryDogByName(String name); }

创建service接口实现类

package com.java.ym.service.impl; import com.java.ym.entity.Dog; import com.java.ym.mapper.DogMapper; import com.java.ym.service.DogService; import java.util.List; /** * @Author: YuMi * @Date: 2020/10/16 11:28 * ---------------------- * @Comments: 业务逻辑接口实现类 */ public class DogServiceImpl implements DogService { // 调用dao层 private DogMapper dogMapper; public void setDogMapper(DogMapper dogMapper) { this.dogMapper = dogMapper; } @Override public int addDog(Dog dog) { return dogMapper.addDog(dog); } @Override public int deleteDogId(int id) { return dogMapper.deleteDogId(id); } @Override public int updateDog(Dog dog) { return dogMapper.updateDog(dog); } @Override public Dog queryDogId(int id) { return dogMapper.queryDogId(id); } @Override public List<Dog> queryAllDog() { return dogMapper.queryAllDog(); } @Override public Dog queryDogByName(String name) { return dogMapper.queryDogByName(name); } }

配置spring-dao.xml

在写controller先把配置弄完

<?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/context https://www.springframework.org/schema/context/spring-context.xsd"> <!-- 关联数据库配置文件--> <context:property-placeholder location="classpath:database.properties"/> <!-- 连接池: dbcp:半自动化操作,不能自动连接 c3p0:自动化操作,自动化加载配置文件,并且可以自动设置到对象 druid,hikari --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="${jdbc.driver}"/> <property name="user" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="jdbcUrl" value="${jdbc.url}"/> <!-- c3p0连接池私有属性--> <property name="maxPoolSize" value="30"/> <property name="minPoolSize" value="10"/> <!-- 关闭连接数据库不自动commit--> <property name="autoCommitOnClose" value="false"/> <!-- 获取连接超时时间--> <property name="checkoutTimeout" value="10000"/> <!-- 当获取连接失败重试次数--> <property name="acquireRetryAttempts" value="2"/> </bean> <!-- sqlSessionFactory--> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <!-- 绑定mybatis-config.xml配置文件--> <property name="configLocation" value="classpath:mybatis-config.xml"/> </bean> <!-- 配置dao接口扫描包,动态实现dao接口道spring容器里--> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <!-- 动态注入sqlSessionFactory--> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> <!-- 扫描dao包--> <property name="basePackage" value="com.java.ym.mapper"/> </bean> </beans>

配置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:mvc="http://www.springframework.org/schema/mvc" 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/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd"> <!-- 注解驱动--> <mvc:annotation-driven/> <!-- 静态资源过滤--> <mvc:default-servlet-handler/> <!-- 视图解析器--> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp"/> </bean> <!-- 扫描controller包--> <context:component-scan base-package="com.java.ym.controller"/> </beans>

配置spring-service.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: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.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop https://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <!-- 扫描service包--> <context:component-scan base-package="com.java.ym.service"/> <!-- 把所有的业务类注入到spring,可以通过配置或注解实现--> <bean id="dogService" class="com.java.ym.service.impl.DogServiceImpl"> <property name="dogMapper" ref="dogMapper"/> </bean> <!-- 声明事务--> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <!-- 注入数据源--> <property name="dataSource" ref="dataSource"/> </bean> <!-- 配置AOP实现事务的织入--> <!-- 配置事务通知--> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <!-- 配置事务的传播特性--> <tx:attributes> <tx:method name="*" propagation="REQUIRED"/> </tx:attributes> </tx:advice> <!-- 配置事务切入--> <aop:config> <aop:pointcut id="txPointcut" expression="execution(* com.java.ym.mapper.DogMapper.*(..))"/> <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"></aop:advisor> </aop:config> </beans>

配置applicationContext.xml

将前面的三个spring配置文件导入到一个总配置里,这样做代码阅读性高,各做各的

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <import resource="classpath:spring-dao.xml"/> <import resource="classpath:spring-service.xml"/> <import resource="classpath:spring-mvc.xml"/> </beans>

配置web/WEB-INF下的web.xml

/: 只匹配所有的请求,不会去匹配jsp页面 / * : 匹配所有的请求,包括jsp页面*/ 底下的乱码过滤的/*不用在意,复制过去就可以 <?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_4_0.xsd" version="4.0"> <!-- 配置DispatcherServlet: springmvc的核心: 请求分发器,前端控制器 --> <servlet> <servlet-name>dispatcherServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <!-- 关联一个Springmvc的配置文件[serlvet-name]-servlet.xml --> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext.xml</param-value> </init-param> <!-- 启动级别1--> <load-on-startup>1</load-on-startup> </servlet> <!-- SpringMVC --> <servlet-mapping> <servlet-name>dispatcherServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <!-- 乱码过滤--> <filter> <filter-name>CharacterEncodingFilter</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>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- session--> <session-config> <session-timeout>15</session-timeout> </session-config> </web-app>

创建controller类

package com.java.ym.controller; import com.java.ym.entity.Dog; import com.java.ym.service.DogService; 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.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import java.util.ArrayList; import java.util.List; /** * @Author: YuMi * @Date: 2020/10/16 14:22 * ---------------------- * @Comments: 控制层 */ @Controller @RequestMapping("/dog") public class DogController { // controller层调用service层 /** * 自动装配 */ @Autowired @Qualifier("dogService") private DogService dogService; /** * 查询所有宠物信息,返回到宠物展示页面 * @return */ @RequestMapping("/allDog") public String queryDogList(Model model){ List<Dog> dogList = dogService.queryAllDog(); model.addAttribute("list",dogList); return "allDog"; } /** * 跳转到宠物信息填写页面 * @return */ @RequestMapping("/toDog") public String addDogPage(){ return "addDog"; } /** * 新增宠物的请求, * @return */ @RequestMapping("/addDog") public String addDogPageContext(Dog dog){ dogService.addDog(dog); // 重定向到查询所有宠物信息页面,@RequestMapping("/allDog") return "redirect:/dog/allDog"; } /** * 跳转到修改页面 */ @RequestMapping("toUpdateDog") public String updateDogPage(int id,Model model){ Dog queryDogId = dogService.queryDogId(id); model.addAttribute("dogId",queryDogId); return "updateDog"; } /** * 修改数据 */ @RequestMapping("/updateDog") public String updateDog(Dog dog){ dogService.updateDog(dog); return "redirect:/dog/allDog"; } /** * 删除宠物信息 */ @RequestMapping("deleteDog/{dogId}") public String deleteDog(@PathVariable("dogId") int id){ dogService.deleteDogId(id); return "redirect:/dog/allDog"; } /** * 查询宠物名字 */ @RequestMapping("/queryDogName") public String queryOneDogName(String queryDogName,Model model){ Dog dogByName = dogService.queryDogByName(queryDogName); List<Dog> dogList = new ArrayList<>(); dogList.add(dogByName); if (dogByName == null || " ".equals(dogByName)){ dogList = dogService.queryAllDog(); model.addAttribute("Error","未查询"); } model.addAttribute("list",dogList); return "allDog"; } }

jsp相关页面

在这之前在web/WEB-INF下手动创建一个包为jsp,前面配置的视图解析器可以根据自己习惯来更改。(如果感觉自己前端写的不好看,可以去bootstrap官网找.有很多现成的样式)

index.jsp

<%-- Created by IntelliJ IDEA. User: YuMi Date: 2020/10/16 Time: 12:09 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>主页面</title> <style> a{ text-decoration: none; color: blueviolet; } h2{ width: 250px; height: 38px; margin: 100px auto; text-align: center; line-height: 38px; background: deepskyblue; border-radius: 5px; } </style> </head> <body> <h2><a href="/dog/allDog">点击进入宠物信息页面</a> </h2> </body> </html>

alldog.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%-- Created by IntelliJ IDEA. User: YuMi Date: 2020/10/16 Time: 14:29 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>宠物信息页面</title> <%-- BootStrap--%> <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> </head> <body> <div class="container"> <div class="row clearfix"> <div class="color-md-12 column"> <div class="page-header"> <h1> <small>宠物信息-显示所有宠物信息</small> </h1> </div> </div> <div class="row"> <%-- 新增宠物--%> <div class="col-md-4 column"> <a class="btn btn-primary" href="/dog/toDog" >新增宠物信息</a> </div> <%-- 查询宠物--%> <div class="col-md-8 column"> <form class="form-inline" action="/dog/queryDogName" method="post" style="float: right" > <span style="color: red;font-weight: bold">${Error}</span> <input type="text" name="queryDogName" class="form-control" placeholder="请输入要查询的宠物名字"> <input type="submit" value="查询" class="btn btn-primary"> </form> </div> </div> </div> <div class="row clearfix"> <div class="color-md-12 column"> <table class="table table-hover table-striped"> <thead> <tr> <th>宠物名字</th> <th>宠物健康</th> <th>宠物亲密度</th> <th>宠物品种</th> <th>操作</th> </tr> </thead> <%-- 从数据库里查询宠物信息,并且遍历出来--%> <tbody> <c:forEach items="${list}" var="dog"> <tr> <td>${dog.name}</td> <td>${dog.health}</td> <td>${dog.love}</td> <td>${dog.strain}</td> <td> <a href="/dog/deleteDog/${dog.id}">删除</a> &nbsp;|&nbsp; <a href="/dog/toUpdateDog?id=${dog.id}">修改</a> </td> </tr> </c:forEach> </tbody> </table> </div> </div> </div> </body> </html>

addDog.jsp

<%-- Created by IntelliJ IDEA. User: YuMi Date: 2020/10/16 Time: 16:08 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>宠物信息填写页面</title> <%-- BootStrap--%> <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> </head> <body> <div class="container"> <div class="row clearfix"> <div class="color-md-12 column"> <div class="page-header"> <h1> <small>新增宠物信息</small> </h1> </div> </div> <form action="/dog/addDog" method="post"> <div class="form-group"> <label for="dName">宠物名字:</label> <input type="text" name="name" class="form-control" id="dName" required > </div> <div class="form-group"> <label for="dHealth">宠物健康:</label> <input type="text" name="health" class="form-control" id="dHealth" required > </div> <div class="form-group"> <label for="dLove">宠物亲密度:</label> <input type="text" name="love" class="form-control" id="dLove" required > </div> <div class="form-group"> <label for="dStrain">宠物品种:</label> <input type="text" name="strain" class="form-control" id="dStrain" required > </div> <div class="form-group"> <input type="submit" class="form-control" value="添加" > </div> </form> </div> </div> </body> </html>

updateDog.jsp

<%-- Created by IntelliJ IDEA. User: YuMi Date: 2020/10/16 Time: 16:53 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>宠物信息修改页面</title> <%-- BootStrap--%> <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> </head> <body> <div class="container"> <div class="row clearfix"> <div class="color-md-12 column"> <div class="page-header"> <h1> <small>修改宠物信息</small> </h1> </div> </div> <form action="/dog/updateDog" method="post"> <input type="hidden" name="id" value="${dogId.id}"> <div class="form-group"> <label for="dName">宠物名字:</label> <input type="text" name="name" value="${dogId.name}" class="form-control" id="dName" required > </div> <div class="form-group"> <label for="dHealth">宠物健康:</label> <input type="text" name="health" value="${dogId.health}" class="form-control" id="dHealth" required > </div> <div class="form-group"> <label for="dLove">宠物亲密度:</label> <input type="text" name="love" value="${dogId.love}" class="form-control" id="dLove" required > </div> <div class="form-group"> <label for="dStrain">宠物品种:</label> <input type="text" name="strain" value="${dogId.strain}" class="form-control" id="dStrain" required > </div> <div class="form-group"> <input type="submit" class="form-control" value="修改" > </div> </form> </div> </div> </body> </html>

最新回复(0)