mvc层,控制视图层。主要负责与页面的交互。
最后的文件结构图
首先是Controller层:UserController.java
package com.ssm.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ssm.entity.User;
import com.ssm.service.UserService;
/**
* @author zx
* @Date 2017年10月11日 上午9:25:39
* @Class UserController.java
*/
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@RequestMapping(value = "/userName", method = RequestMethod.GET)
public Stri