Spring Controller不会退回到View

时间:2015-07-31 16:58:56

标签: spring model-view-controller

我正在将我的应用程序与instamojo集成以进行支付网关集成。 并为WebHook URL编写了控制器

   @RequestMapping(value="/instamojo/Webhook", method= RequestMethod.POST)
    public ModelAndView payment(HttpServletRequest request) throws JSONException{
        ModelAndView view = new ModelAndView("bookingdetail");
        String payment_id = request.getParameter("payment_id");
        String status = request.getParameter("status");
        String email=request.getParameter("buyer");
        String name=request.getParameter("buyer_name");
        String phone=request.getParameter("buyer_phone");
        JSONObject jObj = new JSONObject(request.getParameter("custom_fields"));
        return view;
    }

我可以获得payment_id,状态,电子邮件,姓名但不会重定向到已定义的ModelAndView部分(“bookingdetail”)。请建议我一些灵魂。

1 个答案:

答案 0 :(得分:1)

如果bookingdetail是网址而非实际视图名称,则需要将redirect:添加到视图字符串中:

  ModelAndView view = new ModelAndView("redirect:bookingdetail");