• 大小: 23.57MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-22
  • 语言: 其他
  • 标签: Spring  SpringMVC  MyBatis  

资源简介

Spring+SpringMVC+MyBatis三大框架基于maven的搭建Demo

资源截图

代码片段和文件信息

package com.java.zxf.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.java.zxf.domain.User;
import com.java.zxf.service.UserService;

/**
 * 用户控制器
 */
@Controller
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping(value = “/user“ method = RequestMethod.GET)
    public ModelAndView login(@RequestParam(value=“id“required=true) String id) {
        User user = userService.getUserById(id);

        ModelAndView mav = new ModelAndView();
        if (user == null) {
         //跳转至失败页
         mav.setViewName(“fail“);
            return mav;
        } else {
         //跳转至成功页
         mav.addobject(“id“ user.getId());
         mav.addobject(“name“ user.getUserName());
         mav.addobject(“gender“ user.getUserGender());
         mav.addobject(“birthday“ user.getUserBirthday());
            mav.setViewName(“success“);
            return mav;
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-04-26 14:34  SSMDemo\
     文件        1296  2018-04-24 13:42  SSMDemo\.classpath
     文件        1216  2018-04-24 12:21  SSMDemo\.project
     目录           0  2018-04-24 12:21  SSMDemo\.settings\
     文件         575  2018-04-24 12:21  SSMDemo\.settings\.jsdtscope
     文件         198  2018-04-26 14:20  SSMDemo\.settings\org.eclipse.core.resources.prefs
     文件         430  2018-04-24 12:21  SSMDemo\.settings\org.eclipse.jdt.core.prefs
     文件          90  2018-04-24 12:21  SSMDemo\.settings\org.eclipse.m2e.core.prefs
     文件         835  2018-04-24 13:42  SSMDemo\.settings\org.eclipse.wst.common.component
     文件         252  2018-04-24 12:21  SSMDemo\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2018-04-24 12:21  SSMDemo\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2018-04-24 12:21  SSMDemo\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件          50  2018-04-24 12:21  SSMDemo\.settings\org.eclipse.wst.validation.prefs
     文件        3132  2018-04-25 10:23  SSMDemo\pom.xml
     目录           0  2018-04-24 12:21  SSMDemo\src\
     目录           0  2018-04-24 12:21  SSMDemo\src\main\
     目录           0  2018-04-26 11:41  SSMDemo\src\main\java\
     目录           0  2018-04-26 11:41  SSMDemo\src\main\java\com\
     目录           0  2018-04-26 11:41  SSMDemo\src\main\java\com\java\
     目录           0  2018-04-26 12:14  SSMDemo\src\main\java\com\java\zxf\
     目录           0  2018-04-26 12:09  SSMDemo\src\main\java\com\java\zxf\controller\
     文件        1326  2018-04-26 14:30  SSMDemo\src\main\java\com\java\zxf\controller\UserController.java
     目录           0  2018-04-26 12:02  SSMDemo\src\main\java\com\java\zxf\dao\
     文件         347  2018-04-26 12:02  SSMDemo\src\main\java\com\java\zxf\dao\UserDao.java
     文件        2998  2018-04-26 15:51  SSMDemo\src\main\java\com\java\zxf\dao\UserMapper.xml
     目录           0  2018-04-26 11:56  SSMDemo\src\main\java\com\java\zxf\domain\
     文件         960  2018-04-26 11:56  SSMDemo\src\main\java\com\java\zxf\domain\User.java
     目录           0  2018-04-26 12:18  SSMDemo\src\main\java\com\java\zxf\service\
     文件         186  2018-04-26 16:30  SSMDemo\src\main\java\com\java\zxf\service\UserService.java
     目录           0  2018-04-26 12:21  SSMDemo\src\main\java\com\java\zxf\service\impl\
     文件         465  2018-04-26 14:30  SSMDemo\src\main\java\com\java\zxf\service\impl\UserServiceImpl.java
............此处省略94个文件信息

评论

共有 条评论