简体   繁体   English

Spring WebFlow:POST 从流到 MVC Controller

[英]Spring WebFlow: POST from flow to MVC Controller

I have MVC Controller as below and mapped /home to that controller.我有如下 MVC Controller 并将/home映射到该 controller。 To redirect to /home from flow i use externalRedirect:contextRelative:/home in view attribute.要从流重定向到/home ,我在view属性中使用externalRedirect:contextRelative:/home Is possible to pass some data to /home in POST ?是否可以在POST中将一些数据传递给/home

MVC Controller MVC Controller

@Controller
public class MainController {

    @RequestMapping(value="/home", method=RequestMethod.POST)
    public String index(@RequestParam String data) {
        return "index";
    }
}

Flow流动

<end-state id="home" view="externalRedirect:contextRelative:/home" />

No.不。

When you are specifying externalRedirect: Spring Webflow is going to set a redirect code and Location header on your response which simply instructs the browser to perform a GET request for the specified location.当您指定externalRedirect: Spring Webflow 将在您的响应中设置重定向代码和 Location header,它只是指示浏览器对指定位置执行 GET 请求。 You can include query parameters appended to this location but not POST data.您可以包含附加到此位置的查询参数,但不能包含 POST 数据。

For example:例如:

<end-state id="home" view="externalRedirect:contextRelative:/home?foo=bar" />

Also note that you can include ${expressions} in this string that will be evaluated against the request context, according to the XSD .另请注意,您可以根据XSD在此字符串中包含 ${expressions} ,该字符串将针对请求上下文进行评估。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM