栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

ssm代码

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

ssm代码

修改pom.xml

    
    
      org.springframework
      spring-context
      4.3.8.RELEASE
    

    
    
      org.springframework
      spring-core
      4.3.8.RELEASE
    
    
    
      org.springframework
      spring-beans
      4.3.8.RELEASE
    
    
      org.springframework
      spring-webmvc
      4.3.8.RELEASE
    
    
    
      com.fasterxml.jackson.core
      jackson-core
      2.9.0
    
    
    
      com.fasterxml.jackson.core
      jackson-databind
      2.9.0
    
    
    
      com.fasterxml.jackson.core
      jackson-annotations
      2.9.0
    
    
      org.mybatis
      mybatis-spring
      1.3.2
    
    
      org.mybatis
      mybatis
      3.4.6
    
    
    
      com.alibaba
      druid
      1.1.10
    
    
    
      org.springframework
      spring-tx
      4.3.8.RELEASE
    
    
    
      org.springframework
      spring-jdbc
      4.3.8.RELEASE
    

resource文件夹下新建spring.xml(17,24,25,26,27,48视情况更改



    
    
    
    

    
    
    
        
        
        
        
        
        
        
        
    
    
    
    
        
    
    
    
    
    
    
        
         init(){
        return us.findAll();
    }

    @RequestMapping("/find.do")
    public Bank fd(int uid){
        return us.find(uid);
    }

}
package com.cjy.test.dao;

import com.cjy.test.entity.Bank;

import java.util.List;

public interface BankDAO {
    public List findAll();
    public Bank findById(int id);
}
package com.cjy.test.entity;

public class Bank {
    private int id;
    private String name;
    private  int money;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }
}
package com.cjy.test.services;

import com.cjy.test.dao.BankDAO;
import com.cjy.test.entity.Bank;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

//
@Service
public class BankService {
    @Resource
    private BankDAO bdao;

    public List findAll(){
        return bdao.findAll();
    }
    public Bank find(int id){
        return bdao.findById(id);
    }
}

修改web.xml


  Archetype Created Web Application
  
  
    contextConfigLocation
    classpath:spring.xml
  
  
  
    org.springframework.web.context.ContextLoaderListener
  
  
  
    springmvc
    org.springframework.web.servlet.DispatcherServlet
    
      contextConfigLocation
      classpath:spring.xml
    
  
  
    springmvc
    *.do
  

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/270169.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号