zoukankan      html  css  js  c++  java
  • ssm框架整合

     需求

    使用springmvcmybatis完成商品列表查询。

    整合思路

    整合dao

    mybatisspring进行整合

     sqlMapConfig.xml

     applicationContext-dao.xml

    然后通过逆向工程生成po类和mapper,

     ItemsMapperCustom.xml

    ItemsMapperCustom.java

     spring容器配置service(applicationContext-service.xml)

     事务控制(applicationContext-transaction.xml)

     整合springmvc

    springmvc.xml:

    <!-- 可以扫描controllerservice...

    这里让扫描controller,指定controller的包

     -->

    <context:component-scan base-package="cn.itcast.ssm.controller"></context:component-scan>

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

    <!-- 视图解析器

    解析jsp解析,默认使用jstl标签,classpath下的得有jstl的包

     -->

    <bean

    class="org.springframework.web.servlet.view.InternalResourceViewResolver">

    <!-- 配置jsp路径的前缀 -->

    <property name="prefix" value="/WEB-INF/jsp/"/>

    <!-- 配置jsp路径的后缀 -->

    <property name="suffix" value=".jsp"/>

    </bean>

     编写Controller(就是Handler)

     加载spring容器

    参数绑定

    原理:将客户的请求数据绑定到controller方法的形参上

    springmvc中,接收页面提交的数据是通过方法形参来接收。而不是在controller类定义成员变更接收!!!!

    pojo绑定

     controllerpojo形参的定义:

  • 相关阅读:
    树上路径
    [HNOI2017]礼物
    Spoj 8372 Triple Sums
    [Swerc2014 C]Golf Bot
    【bzoj2194】快速傅立叶之二 FFT
    Linux下perl模块安装
    angularjs form表单验证
    Angularjs兼容IE
    input file限制上传文件类型
    angularjs判断页面数据是否渲染完成
  • 原文地址:https://www.cnblogs.com/jingyukeng/p/10325748.html
Copyright © 2011-2022 走看看