springmvc怎樣只跳轉頁面?
在spring mvc中實現在Controller中進行頁面跳轉有兩種方式
1.Java代碼
public ModelAndView login(HttpServletResponse response, String id) {
response.sendRedirect("index.do="+id);
return null;
}
public ModelAndView login(HttpServletResponse response, String id) {
response.sendRedirect("index.do="+id);
return null;
}
2.Java代碼
public ModelAndView login(HttpServletResponse response, String id) {
return new ModelAndView("redirect:index.do="+id);
}
public ModelAndView login(HttpServletResponse response, String id) {
return new ModelAndView("redirect:index.do="+id);
}
return new ModelAndView("redirect:" + downloadUrl);