springMvc附加

RestFul 风格:

https://127.0.0.1:8080/add/1/1

@RequestMapping("/add/{a}/{b}")

public String test1(@PathVariable int a,@PathVariable int a){

}

 

转发 重定向

有视图解析器的情况下:

转发  return “index;

重定向 return ”redirect:index.jsp;

无视图解析器的情况下:

转发  request.getRequestDispathcher("/WEB-INF/jsp/test.jsp").forward(request,response);

重定向 response.sendRedirect("/index,jsp);

 

json返回

@RequestBody 

 

posted on 2021-03-15 14:32  眼里有星辰  阅读(13)  评论(0编辑  收藏  举报