5
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"リクエストマッピングにリダイレクトしたいと思います。春のコントローラの方法でSpring MVCでPOSTにリダイレクトする方法
bindingResultsがこの方法で失われています。任意の解決策。? – masT
結合結果は失われません。ここでは、GETメソッドとPOSTメソッドの両方を受け入れるようにhandleメソッドに指示します。 –
技術的な観点からはこれはうまくいきますが、RESTfulアプリケーションを作成している場合、これはGETの "副作用"の期待に反してしまうでしょう。私は、別の方法を見つけたり、それを本当に、本当にうまく文書化することを勧めます(最低限) – romeara