重定向問題
java
@Controller @RequestMapping("/StdManage") public class StdManageController { @RequestMapping("/test1") public String test1() { return "test1"; } @RequestMapping("/test2") public String test2() { return "redirect:test2"; } @RequestMapping("/test3") public String test3() { return "redirect:/test3"; } }
test1至關於getRequestDispatcher,跳轉視圖解析器映射的test1.jspapp
test2至關於sendRedirect,跳轉相對於當前路徑地址: localhost:8080/StdManage/test2
jsp
test3至關於sendRedirect,跳轉相對於根路徑地址: localhost:8080/test3spa