• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • maven構建spring mvc項目 + Mybatis整合(3)

    發表于:2013-11-29來源:Csdn作者:Abel-Lin點擊數: 標簽:軟件測試
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springfra

      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

      http://www.springframework.org/schema/context

      http://www.springframework.org/schema/context/spring-context-3.0.xsd

      http://www.springframework.org/schema/tx

      http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

      http://www.springframework.org/schema/jdbc

      http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd

      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

      

      

      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

      

      

      

      classpath:/jdbc.properties

      

      

      

      

      

      

      

      

      

      

      

      

      class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      5、mybatis-generator.xml (MyBatis自動生成映射文件:model、dao)

      [html] view plaincopy

      

      PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"

      "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      connectionURL="jdbc:mysql://localhost/can_mall" userId="root"

      password="123">

      

      

      

      

      

      

      

      targetProject="src/main/java">

      

      

      

      

      

      targetProject="src/main/resources">

      

      

      

      

      targetPackage="cn.com.abel.springProject.dao" targetProject="src/main/java">

      

      

      

      

      

      

      

      

      

      

      6、IndexController.java

      [java] view plaincopypackage cn.com.abel.springProject.controller;

      import org.springframework.beans.factory.annotation.Autowired;

      import org.springframework.stereotype.Controller;

      import org.springframework.ui.ModelMap;

      import org.springframework.web.bind.annotation.RequestMapping;

      import cn.com.abel.springProject.dao.TestModelMapper;

      import cn.com.abel.springProject.model.TestModel;

      /**

      TestModelMapper與TestModel為Mybatis自動生成的dao和model

      */

      @Controller

      @RequestMapping("")

      public class IndexController {

      @Autowired

      private TestModelMapper testDao;

      @RequestMapping

      public String index(ModelMap model) {

      //從testTable中查找ID為1的記錄

      TestModel testModel = testDao.selectByPrimaryKey(1L);

      model.addAttribute("testModel", testModel);

      model.addAttribute("hello", "hfffello spring mvc");

      return "index";

      }

      }

    原文轉自:http://blog.csdn.net/rongku/article/details/13053455

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>