1.controller
package it.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sun.deploy.net.HttpResponse;
import it.po.User;
import it.po.Vo;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping("/user")
public class UserController {
//请求地址 http://localhost:8080/user/qucik
@RequestMapping(value = "/quick", method = RequestMethod.GET)
public String save() {
System.out.println("Controller save running------");
return "success";
}
@RequestMapping(value = "/quick2")
public ModelAndView save2() {
/**
* Model :模型 作用封装数据
* View :视图 作用展示数据
*/
ModelAndView modelAndView = new ModelAndView();
//设置模型数据
modelAndView.addObject("username", "啊哈哈!");
//设置视图名称
modelAndView.setViewName("success");
return modelAndView;
}
@RequestMapping(value = "/quick3")
public ModelAndView save3(ModelAndView modelAndView) {
//设置模型数据
modelAndView.addObject("username", "广信集团!");
//设置视图名称
modelAndView.setViewName("success");
return modelAndView;
}
@RequestMapping(value = "/quick4")
public String save4(Model model) {
//设置模型数据
model.addAttribute("username", "广信集团lj !");
return "success";
}
@RequestMapping(value = "/quick5")
@ResponseBody //