/** * 转发 forward:资源路径 * 重定向 redirect:资源路径 */ @RequestMapping("demo8") public String demo8() { return "redirect:/login.jsp"; }
/** * 如果在前天加了forward或redirect则会走默认解析器 * @return */ @RequestMapping("demo9") public String demo9() { return "forward:demo10"; } @RequestMapping("demo10") public String demo10() { return "login"; }
<bean id="viewResole" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/"></property> <property name="suffix" value=".jsp"></property> </bean>
原文:https://www.cnblogs.com/lastingjava/p/10013973.html