SpringMVC(二八) 重定向
在控制器中在返回的字符串中使用 return "redirect:/index.jsp" 的形式,使返回重定向到另外一个页面。
控制器参考代码:
package com.tiekui.springmvc.handlers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class RedirectTest {
@RequestMapping("testRedirect")
public String testRedirect(){
return "redirect:helloworld";
}
}
访问视图代码:
<a href="testRedirect">Test Redirect Video 28</a>
https://github.com/godmaybelieve


浙公网安备 33010602011771号