Restful中使用redirect

来源:互联网 发布:ipad小说软件 编辑:程序博客网 时间:2024/05/22 08:40

代码如下:

import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;/** * @author Administrator * */@Controller@RequestMapping(value = "/home")public class LocationRestfulController extends BaseController {    @RequestMapping(method = RequestMethod.GET)    public String go() {//      return "redirect:test"; // 访问http://localhost:8080/home会跳转到http://localhost:8080/test//      return "redirect:/test"; // 访问http://localhost:8080/home会跳转到http://localhost:8080/test//      return "redirect:home/test"; // 访问http://localhost:8080/home会跳转到http://localhost:8080/home/test        return "redirect:/home/test";// 访问http://localhost:8080/home会跳转到http://localhost:8080/home/test    }}
原创粉丝点击