ModelAndView
需要方法结束时,定义ModelAn和view分别进行设置
String
####返回逻辑视图名
通过形参的model将model数据传入页面
model.addAttribute(arg0,arg1);
redirect重定向
redirect重定向,浏览器地址url会变化,修改提交的request数据无法重定向地址,重定向后重新生成request,无法共享
return "redirect:/xx/xx"
页面转发
url不变,request可以共享
return "forward:/xx/xx"
void
直接通过request和response操作
request.getRequestDispatcher("xxx").forward(request,respose);
response.sendRedirect("xxx");
response.setCharacterEncoding("utf-8");
response.setContentType("application/json;charset=utf-8");
response.getWriter().write("json串");