姬長信(Redy)

spring-mvc – 如何在Spring MVC中重定向到POST


I have written code as given below-


@Controller
@RequestMapping("something")
public class somethingController {
   @RequestMapping(value="/someUrl",method=RequestMethod.POST)
   public String myFunc(HttpServletRequest request,HttpServletResponse response,Map model){
    //do sume stuffs
     return "redirect:/anotherUrl"; //gets redirected to the url '/anotherUrl'
   }

  @RequestMapping(value="/anotherUrl",method=RequestMethod.POST)
  public String myAnotherFunc(HttpServletRequest request,HttpServletResponse response){
    //do sume stuffs
     return "someView"; 
  }
}

我想重定向到请求方法为POST的“anotherUrl”请求映射.