SSM整合小案例

SSM整合

数据库部分(Oracle)

  1. 创建表

    CREATE TABLE product(
    id varchar2(32) default SYS_GUID() PRIMARY KEY,
    productNum VARCHAR2(50) NOT NULL,
    productName VARCHAR2(50),
    cityName VARCHAR2(50),
    DepartureTime timestamp,
    productPrice Number,
    productDesc VARCHAR2(500),
    productStatus INT,
    CONSTRAINT product UNIQUE (id, productNum)
    )
    
  2. 添加数据

    insert into PRODUCT (id, productnum, productname, cityname, departuretime, productprice, productdesc, productstatus)
    values ('D71D9D079C224C749F8FC526DA39E7B7', 'junyang-002', '北京三日游', '北京', to_timestamp('10-10-2020 10:10:00.000000', 'dd-mm-yyyy hh24:mi:ss.ff'), 1299, '不到北京非好汉', 1);
    insert into PRODUCT (id, productnum, productname, cityname, departuretime, productprice, productdesc, productstatus)
    values ('F4971A072D4C482196A39E219BCBF932', 'junyang-003', '上海七日游', '上海', to_timestamp('10-10-2020 11:10:00.000000', 'dd-mm-yyyy hh24:mi:ss.ff'), 1599, '魔都,你值得来', 0);
    insert into PRODUCT (id, productnum, productname, cityname, departuretime, productprice, productdesc, productstatus)
    values ('058BBC3C69C54FADB14CFAD2517ACF48', 'junyang-003', '北京七日游', '北京', to_timestamp('05-01-2020 08:10:00.000000', 'dd-mm-yyyy hh24:mi:ss.ff'), 3000, '好好感受首都的魅力', 0);
    commit;
    

项目部分

  1. 创建maven工程
    1. 父工程 --com.junyang.ssm

      1. 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.junyang</groupId>
          <artifactId>ssm</artifactId>
          <packaging>pom</packaging>
          <version>1.0-SNAPSHOT</version>
          <properties>
              <spring.version>5.0.2.RELEASE</spring.version>
              <slf4j.version>1.6.6</slf4j.version>
              <log4j.version>1.2.12</log4j.version>
              <oracle.version>11.2.0.1.0</oracle.version>
              <mybatis.version>3.4.5</mybatis.version>
              <spring.security.version>5.0.1.RELEASE</spring.security.version>
          </properties>
      
          <dependencies>        <!-- spring -->
              <dependency>
                  <groupId>org.aspectj</groupId>
                  <artifactId>aspectjweaver</artifactId>
                  <version>1.6.8</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-aop</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-context</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-context-support</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-web</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-orm</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-beans</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-core</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-test</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-webmvc</artifactId>
                  <version>${spring.version}</version>
      
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-tx</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <version>4.12</version>
                  <scope>test</scope>
              </dependency>
      
              <dependency>
                  <groupId>javax.servlet</groupId>
                  <artifactId>javax.servlet-api</artifactId>
                  <version>3.1.0</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>        <!-- log start -->
              <dependency>
                  <groupId>log4j</groupId>
                  <artifactId>log4j</artifactId>
                  <version>${log4j.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-api</artifactId>
                  <version>${slf4j.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-log4j12</artifactId>
                  <version>${slf4j.version}</version>
              </dependency>    
      
              <dependency>
                  <groupId>org.mybatis</groupId>
                  <artifactId>mybatis</artifactId>
                  <version>${mybatis.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.mybatis</groupId>
                  <artifactId>mybatis-spring</artifactId>
                  <version>1.3.0</version>
              </dependency>
              <dependency>
                  <groupId>c3p0</groupId>
                  <artifactId>c3p0</artifactId>
                  <version>0.9.1.2</version>
                  <type>jar</type>
                  <scope>compile</scope>
              </dependency>
              <dependency>
                  <groupId>com.github.pagehelper</groupId>
                  <artifactId>pagehelper</artifactId>
                  <version>5.1.2</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework.security</groupId>
                  <artifactId>spring-security-web</artifactId>
                  <version>${spring.security.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework.security</groupId>
                  <artifactId>spring-security-config</artifactId>
                  <version>${spring.security.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework.security</groupId>
                  <artifactId>spring-security-core</artifactId>
                  <version>${spring.security.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework.security</groupId>
                  <artifactId>spring-security-taglibs</artifactId>
                  <version>${spring.security.version}</version>
              </dependency>
      
              <dependency>
                  <groupId>com.oracle</groupId>
                  <artifactId>ojdbc6</artifactId>
                  <version>12.1.0.1-atlassian-hosted</version>
              </dependency>
      
              <dependency>
                  <groupId>javax.annotation</groupId>
                  <artifactId>jsr250-api</artifactId>
                  <version>1.0</version>
              </dependency>
          </dependencies>
          <build>
              <pluginManagement>
                  <plugins>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-compiler-plugin</artifactId>
                          <version>3.2</version>
                          <configuration>
                              <source>1.8</source>
                              <target>1.8</target>
                              <encoding>UTF-8</encoding>
                              <showWarnings>true</showWarnings>
                          </configuration>
                      </plugin>
                  </plugins>
              </pluginManagement>
          </build>
      </project>
      
    2. ssm_domain – com.junyang.ssm_domain

      1. 建立实体类

        package com.junyang.ssm.domain;
        
        import java.io.Serializable;
        import java.util.Date;
        
        /**
         * 产品信息模型
         */
        public class Product implements Serializable {
            private String id; // 主键
            private String productNum; // 编号 唯一
            private String productName; // 名称
            private String cityName; // 出发城市
            private Date departureTime; // 出发时间
            private String departureTimeStr;
            private Double productPrice; // 产品价格
            private String productDesc; // 产品描述
            private Integer productStatus; // 状态 0 关闭 1 开启
            private String productStatusStr;
        
            @Override
            public String toString() {
                return "Product{" +
                        "id='" + id + '\'' +
                        ", productNum='" + productNum + '\'' +
                        ", productName='" + productName + '\'' +
                        ", cityName='" + cityName + '\'' +
                        ", departureTime=" + departureTime +
                        ", departureTimeStr='" + departureTimeStr + '\'' +
                        ", productPrice=" + productPrice +
                        ", productDesc='" + productDesc + '\'' +
                        ", productStatus=" + productStatus +
                        ", productStatusStr='" + productStatusStr + '\'' +
                        '}';
            }
        
            public String getId() {
                return id;
            }
        
            public void setId(String id) {
                this.id = id;
            }
        
            public String getProductNum() {
                return productNum;
            }
        
            public void setProductNum(String productNum) {
                this.productNum = productNum;
            }
        
            public String getProductName() {
                return productName;
            }
        
            public void setProductName(String productName) {
                this.productName = productName;
            }
        
            public String getCityName() {
                return cityName;
            }
        
            public void setCityName(String cityName) {
                this.cityName = cityName;
            }
        
            public Date getDepartureTime() {
                return departureTime;
            }
        
            public void setDepartureTime(Date departureTime) {
                this.departureTime = departureTime;
            }
        
            public String getDepartureTimeStr() {
                return departureTimeStr;
            }
        
            public void setDepartureTimeStr(String departureTimeStr) {
                this.departureTimeStr = departureTimeStr;
            }
        
            public double getProductPrice() {
                return productPrice;
            }
        
            public void setProductPrice(double productPrice) {
                this.productPrice = productPrice;
            }
        
            public String getProductDesc() {
                return productDesc;
            }
        
            public void setProductDesc(String productDesc) {
                this.productDesc = productDesc;
            }
        
            public Integer getProductStatus() {
                return productStatus;
            }
        
            public void setProductStatus(Integer productStatus) {
                this.productStatus = productStatus;
            }
        
            public String getProductStatusStr() {
                return productStatusStr;
            }
        
            public void setProductStatusStr(String productStatusStr) {
                this.productStatusStr = productStatusStr;
            }
        }						
        
    3. ssm_dao – com.junyang.ssm_dao

      1. 在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">
          <parent>
              <artifactId>ssm</artifactId>
              <groupId>com.junyang</groupId>
              <version>1.0-SNAPSHOT</version>
          </parent>
          <modelVersion>4.0.0</modelVersion>
          <dependencies>
              <dependency>
                  <groupId>com.junyang</groupId>
                  <artifactId>ssm_domain</artifactId>
                  <version>1.0-SNAPSHOT</version>
              </dependency>
          </dependencies>
          <artifactId>ssm_dao</artifactId>
      
      
      </project>
      
      1. 编写dao代码

        package com.junyang.ssm.dao;
        
        import com.junyang.ssm.domain.Product;
        import org.apache.ibatis.annotations.Select;
        import org.springframework.stereotype.Repository;
        
        import java.util.List;
        
        /**
         * 产品信息Dao
         */
        @Repository
        public interface ProductDao {
            /**
             * 查询所有产品信息
             * @return
             */
            @Select("select * from product")
            List<Product> findAll();
        }
        
        
    4. ssm_service – com.junyang.ssm_service

      1. 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">
            <parent>
                <artifactId>ssm</artifactId>
                <groupId>com.junyang</groupId>
                <version>1.0-SNAPSHOT</version>
            </parent>
            <modelVersion>4.0.0</modelVersion>
        
            <artifactId>ssm_service</artifactId>
            <dependencies>
                <dependency>
                    <groupId>com.junyang</groupId>
                    <artifactId>ssm_dao</artifactId>
                    <version>1.0-SNAPSHOT</version>
                </dependency>
            </dependencies>
        
        </project>
        
      2. 编写service代码

        package com.junyang.ssm.service;
        
        import com.junyang.ssm.domain.Product;
        import org.apache.ibatis.annotations.Select;
        import org.springframework.stereotype.Service;
        import org.springframework.transaction.annotation.Transactional;
        
        import java.util.List;
        
        public interface ProductService {
            /**
             * 查询所有信息
             * @return
             */
            @Select("select * from product")
            List<Product> findAll();
        }
        
      3. 创建impl包并编写service实现类ProductServiceImpl

        package com.junyang.ssm.service.impl;
        
        import com.junyang.ssm.dao.ProductDao;
        import com.junyang.ssm.domain.Product;
        import com.junyang.ssm.service.ProductService;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.stereotype.Service;
        import org.springframework.transaction.annotation.Transactional;
        
        import java.util.List;
        @Transactional
        @Service
        public class ProductServiceImpl implements ProductService {
            @Autowired
            private ProductDao ProductDao;
            @Override
            public List<Product> findAll() {
                return ProductDao.findAll();
            }
        }
        
        
    5. ssm_web – com.junyang.ssm_web

      1. 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">
            <parent>
                <artifactId>ssm</artifactId>
                <groupId>com.junyang</groupId>
                <version>1.0-SNAPSHOT</version>
            </parent>
            <modelVersion>4.0.0</modelVersion>
        
            <artifactId>ssm_web</artifactId>
            <packaging>war</packaging>
            <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <maven.compiler.source>1.8</maven.compiler.source>
                <maven.compiler.target>1.8</maven.compiler.target>
            </properties>
        
            <dependencies>
                <dependency>
                    <groupId>com.junyang</groupId>
                    <artifactId>ssm_service</artifactId>
                    <version>1.0-SNAPSHOT</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat7-maven-plugin</artifactId>
                        <configuration>
                            <port>8889</port>
                        </configuration>
        
                        <version>2.2</version>
                    </plugin>
                </plugins>
            </build>
        </project>
        
        
      2. 编写controller代码

        package com.junyang.ssm.web;
        
        import com.junyang.ssm.domain.Product;
        import com.junyang.ssm.service.ProductService;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.stereotype.Controller;
        import org.springframework.web.bind.annotation.RequestMapping;
        import org.springframework.web.servlet.ModelAndView;
        
        import java.util.List;
        
        @Controller
        @RequestMapping("/product")
        public class ProductController {
            @Autowired
            private ProductService ProductService;
            @RequestMapping("/findAll1")
            public void findAll1(){
                List<Product> productList = ProductService.findAll();
                for (Product product : productList) {
                    System.out.println(product);
                }
            }
        }
        
  2. 添加配置文件 – 在ssm_webresources下创建
    1. applicationContext.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
      	http://www.springframework.org/schema/context/spring-context.xsd
      	http://www.springframework.org/schema/aop
      	http://www.springframework.org/schema/aop/spring-aop.xsd
      	http://www.springframework.org/schema/tx
      	http://www.springframework.org/schema/tx/spring-tx.xsd">
          <!--开启注解扫描,让spring管理service和dao-->
          <context:component-scan base-package="com.junyang.ssm.dao"/>
          <context:component-scan base-package="com.junyang.ssm.service"/>
          <!--加载db.properties配置文件-->
          <context:property-placeholder location="classpath:db.properties"/>
          <!--配置连接池-->
          <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
              <property name="driverClass" value="${jdbc.driver}" />
              <property name="jdbcUrl" value="${jdbc.url}" />
              <property name="user" value="${jdbc.username}" />
              <property name="password" value="${jdbc.password}" />
          </bean>
          <!--SqlSessionFactory交由spring管理-->
          <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
              <property name="dataSource" ref="dataSource"/>
          </bean>
          <!--扫描dao接口-->
          <bean id="apperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
              <property name="basePackage" value="com.junyang.ssm.dao"></property>
          </bean>
          <!-- 配置Spring的声明式事务管理 -->
          <!-- 配置事务管理器 -->
          <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
              <property name="dataSource" ref="dataSource"/>
          </bean>
          <tx:annotation-driven transaction-manager="transactionManager"/>
      </beans>
      
      
    2. db.properties

      jdbc.driver=oracle.jdbc.driver.OracleDriver
      jdbc.url=jdbc:oracle:thin:@localhost:1521:orcl
      jdbc.username=C##ssm
      jdbc.password=root
      
    3. spring-mvc.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:mvc="http://www.springframework.org/schema/mvc"
             xmlns:context="http://www.springframework.org/schema/context"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:aop="http://www.springframework.org/schema/aop"
             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
                 http://www.springframework.org/schema/context/spring-context.xsd
                 http://www.springframework.org/schema/aop
      		http://www.springframework.org/schema/aop/spring-aop.xsd">
          <!--配置扫描controller注解,别的不扫描-->
          <context:component-scan base-package="com.junyang.ssm.web"/>
          <!--配置视图解析器-->
          <bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
              <!-- JSP文件所在的目录 -->
              <property name="prefix" value="/pages/"/>
              <!-- 文件的后缀名 -->
              <property name="suffix" value=".jsp"/>
          </bean>
          <!-- 设置静态资源不过滤 -->
          <mvc:resources location="/css/" mapping="/css/**"/>
          <mvc:resources location="/img/" mapping="/img/**" />
          <mvc:resources location="/js/" mapping="/js/**" />
          <mvc:resources location="/plugins/" mapping="/plugins/**" />
          <!-- 开启对SpringMVC注解的支持 -->
          <mvc:annotation-driven />
          <!--
      		支持AOP的注解支持,AOP底层使用代理技术
      		JDK动态代理,要求必须有接口
      		cglib代理,生成子类对象,proxy-target-class="true" 默认使用cglib的方式
      	-->
          <aop:aspectj-autoproxy proxy-target-class="true"/>
      </beans>
      
    4. 修改web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns="http://xmlns.jcp.org/xml/ns/javaee"
               xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
               version="3.1">
      
        <!-- 配置加载类路径的配置文件 -->
        <context-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>classpath*:applicationContext.xml</param-value>
        </context-param>
      
        <!-- 配置监听器 -->
        <listener>
          <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <!-- 配置监听器,监听request域对象的创建和销毁的 -->
        <listener>
          <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
        </listener>
      
        <!-- 前端控制器(加载classpath:springmvc.xml 服务器启动创建servlet) -->
        <servlet>
          <servlet-name>dispatcherServlet</servlet-name>
          <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
          <!-- 配置初始化参数,创建完DispatcherServlet对象,加载springmvc.xml配置文件 -->
          <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:spring-mvc.xml</param-value>
          </init-param>
          <!-- 服务器启动的时候,让DispatcherServlet对象创建 -->
          <load-on-startup>1</load-on-startup>
        </servlet>
        <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>
      
        <welcome-file-list>
          <welcome-file>index.html</welcome-file>
          <welcome-file>index.htm</welcome-file>
          <welcome-file>index.jsp</welcome-file>
          <welcome-file>default.html</welcome-file>
          <welcome-file>default.htm</welcome-file>
          <welcome-file>default.jsp</welcome-file>
        </welcome-file-list>
      </web-app>
      
      
    5. 创建index.jsp

      <%@ page language="java" contentType="text/html; charset=UTF-8"
               pageEncoding="UTF-8"%>
      <html>
      <body>
          <a href="${pageContext.request.contextPath}/product/findAll1">点击超链接查询所有商品信息</a>
      </body>
      </html>
      
      
    6. 使用父工程maven项目的install命令.

    7. 配置maven
      在这里插入图片描述

    8. 启动,浏览器输入项目地址,访问到首页.点击index中的连接,观察控制台输出.

      Product{id='D71D9D079C224C749F8FC526DA39E7B7', productNum='junyang-002', productName='北京三日游', cityName='北京', departureTime=Sat Oct 10 10:10:00 CST 2020, departureTimeStr='null', productPrice=1299.0, productDesc='不到北京非好汉', productStatus=1, productStatusStr='null'}
      Product{id='F4971A072D4C482196A39E219BCBF932', productNum='junyang-003', productName='上海七日游', cityName='上海', departureTime=Sat Oct 10 11:10:00 CST 2020, departureTimeStr='null', productPrice=1599.0, productDesc='魔都,你值得来', productStatus=0, productStatusStr='null'}
      Product{id='058BBC3C69C54FADB14CFAD2517ACF48', productNum='junyang-003', productName='北京七日游', cityName='北京', departureTime=Sun Jan 05 08:10:00 CST 2020, departureTimeStr='null', productPrice=3000.0, productDesc='好好感受首都的魅力', productStatus=0, productStatusStr='null'}
      
      

SSM整合成功!!!

热门文章

暂无图片
编程学习 ·

【Linux基础编程】echo命令

01.文章目录 文章目录01.文章目录02.命令概述03.命令格式04.常用选项05.参考示例5.1 输出字符串5.2 输出变量PATH5.3 转义特殊字符5.4 重定向到文件中5.5 输出命令结果5.6 输出换行符5.7 输出退格符5.8 输出字符串不换行5.9 支持通配符5.10 指定输出颜色5.11 设置背景色5.12 文…
暂无图片
编程学习 ·

SSM整合小案例

SSM整合 数据库部分(Oracle)创建表 CREATE TABLE product( id varchar2(32) default SYS_GUID() PRIMARY KEY, productNum VARCHAR2(50) NOT NULL, productName VARCHAR2(50), cityName VARCHAR2(50), DepartureTime timestamp, productPrice Number, productDesc VARCHAR2(500…
暂无图片
编程学习 ·

solr自动更新索引,tomcat+solr

核心文件夹: tomcat-8.0.35-search------端口8888 solr-7.2.0------端口8984 核心配置: 用于配置solr索引的定时增量更新和全部更新,两个文件保持一致就可以。 /tomcat/tomcat-8.0.35-search/bin/solr/conf/dataimport.properties /solr-7.2.0/server/solr/chuai/conf/datai…
暂无图片
编程学习 ·

Unity学习(C#)——正则表达式

正则表达式:专门用于字符串处理的语言。 可以 解决: 1.检索:获取我们想要的部分 2.匹配:判断给定字符串是否符合正则表达式的过滤逻辑。即表述了字符串书写的规则。 定位元字符 $、^ (要用using System.Text.RegularExpressions;) $在结尾处插入 ^在开头处插入string s =…
暂无图片
编程学习 ·

钉钉dd.ready中不能调用方法解决,钉钉微应用遇到的坑

钉钉dd.ready中不能调用方法解决获取微应用免登授权码官方代码:dd.ready(function() {dd.runtime.permission.requestAuthCode({corpId: _config.corpId, // 企业idonSuccess: function (info) {code = info.code // 通过该免登授权码可以获取用户身份}}); });code虽然拿到了,…
暂无图片
中恒嘉业 ·

关于主从复制的超详细解析(全)

目录前言1. 主从复制1.1 方式2. Mysql的主从复制2.1 一主一从2.1.1 window和linux通讯2.1.2 linux和linux的通讯2.2 双主双从3. Redis的主从复制3.1 哨兵模式3.2 java代码结合前言 主要介绍mysql的主从复制以及redis的主从复制 能由浅入深的明白原理以及如何操作 再者&#xf…
暂无图片
郑州普通话 ·

将Jetson XavierNX的Ubuntu系统迁移至到nvme硬盘上

第一步&#xff1a;sudo mke2fs -t ext4 /dev/nvme0n1p1 #格式化分区 第二步&#xff1a;将eMMC / SD卡的rootfs复制到SSD git clone https://github.com/jetsonhacks/rootOnNVMe cd rootOnNVMe #进入目录 ./copy-rootfs-ssd.sh #执行复制脚本第三步&#xff1a;安装启动脚本…
暂无图片
代理记账 ·

在web应用中发送和接收Jakarta消息

Running the websimplemessage Example To Package and Deploy websimplemessage Using Maven _1、Make sure that GlassFish Server has been started (see Starting and Stopping GlassFish Server). _2、In a terminal window, go to: tut-install/examples/jms/websimp…
暂无图片
cgfy ·

C++学习日记2——函数、封装、对象特性

一、函数 1.1 函数默认参数 1.1.1 简介 在C中&#xff0c;函数的形参列表中的形参是可以有默认值的 1.1.2 语法 返回值类型 函数名 (参数 默认值) {} 1.1.3 代码 #include <iostream> using namespace std;// 函数的默认参数 int func(int a, int b 20, int c 30…
暂无图片
coreui ·

视频水印怎么去除?超简单 千万不要错过

小编在知乎看到很多大佬分享的视频去水印的方法&#xff0c;但是感觉都有点太复杂了&#xff0c;今天就来分享一下小编自己私藏的几个针对于视频去水印的软件和网站~建议大家收藏哦~ 1、爱给网-视频去水印小工具&#xff08;免费 在线&#xff09; 推荐点 1、在线操作&#…
暂无图片
coreui ·

Mac 安装 tomcat10

Mac 安装 tomcat10 1、下载tomcat tomcat官网&#xff1a;https://tomcat.apache.org/ 点击我下载的tomcat10&#xff1a; 2、下载解压,给bin下的*.sh文件添加可执行权限 3、修改webapps下的ROOT中的index文件查看效果
暂无图片
未来博客 ·

视频水印怎么去除?超简单 千万不要错过

小编在知乎看到很多大佬分享的视频去水印的方法&#xff0c;但是感觉都有点太复杂了&#xff0c;今天就来分享一下小编自己私藏的几个针对于视频去水印的软件和网站~建议大家收藏哦~ 1、爱给网-视频去水印小工具&#xff08;免费 在线&#xff09; 推荐点 1、在线操作&#…
暂无图片
未来博客 ·

Mac 安装 tomcat10

Mac 安装 tomcat10 1、下载tomcat tomcat官网&#xff1a;https://tomcat.apache.org/ 点击我下载的tomcat10&#xff1a; 2、下载解压,给bin下的*.sh文件添加可执行权限 3、修改webapps下的ROOT中的index文件查看效果
暂无图片
建站日记 ·

惠州实验室建设选址、勘察事项

惠州实验室建设选址、勘察事项&#xff0c;SICOLAB技术员带您从实验室建设启动前思考问题考虑如下&#xff1a;一、不同实验室建设选址要求 1.化学实验室 &#xff08;1&#xff09;清洁安静环境 &#xff08;2&#xff09;远离住宅、生活区 &#xff08;3&#xff09;锅炉房与…
暂无图片
建站日记 ·

NLP聊天机器人原理(seq2seq模型)

一、seq2seq模型 1.概念 seq2seq是一个Encoder-Decoder结构的网络&#xff0c;它的输入是一个序列&#xff0c;输出也是一个序列。Encoder中将一个可变长度的信号序列变为固定长度的向量表达&#xff0c;Decoder将这个固定长度的向量变成可变长度的目标的信号序列。这个结构最…
暂无图片
mfbz ·

惠州实验室建设选址、勘察事项

惠州实验室建设选址、勘察事项&#xff0c;SICOLAB技术员带您从实验室建设启动前思考问题考虑如下&#xff1a;一、不同实验室建设选址要求 1.化学实验室 &#xff08;1&#xff09;清洁安静环境 &#xff08;2&#xff09;远离住宅、生活区 &#xff08;3&#xff09;锅炉房与…
暂无图片
mfbz ·

全渠道会员通-天猫会员通3: 会员运营内容准备

在天猫会员通技术对接开发过程中&#xff0c;为了通知存量会员的通知工作&#xff0c;发挥会员通的优势&#xff0c;品牌需要做好以下事宜&#xff1a; 会员体系暂停公告&#xff1a;因会员通技术升级期间&#xff0c;会员服务将被暂停&#xff0c;店铺tab中会员入口将被下线&…
暂无图片
珊珊日记 ·

C# 执行Javascript脚本

c#教程https://www.xin3721.com/eschool/CSharpxin3721/ 前一阵子使用C#编写SCXML状态机&#xff0c;需要解析EMCScript表达式&#xff0c;使用了Jint库&#xff08;https://github.com/sebastienros/jint/)&#xff0c;当时感觉与C#之间的数据转换不是很方便。这两天有时间又关…
暂无图片
珊珊日记 ·

第九届“图灵杯”NEUQ-ACM程序设计竞赛个人赛

A.大学期末现状 题目描述 作为一名大学生的你&#xff0c;现在又到了期末查成绩的时候&#xff0c;当你的成绩大于等于60时请输出“jige,haoye!”,否则输出"laoshi,caicai,laolao"。 输入描述: 一行&#xff0c;一个整数x代表你的成绩&#xff08;0<x<100&a…