Spring WebFlow:从流 POST 到 MVC 控制器
我有如下 MVC 控制器,并将 /home
映射到该控制器。要从流程重定向到 /home
,我在 view
属性中使用 externalRedirect:contextRelative:/home
。是否可以在 POST
中将一些数据传递到 /home
?
MVC 控制器
@Controller
public class MainController {
@RequestMapping(value="/home", method=RequestMethod.POST)
public String index(@RequestParam String data) {
return "index";
}
}
流程
<end-state id="home" view="externalRedirect:contextRelative:/home" />
I have MVC Controller as below and mapped /home
to that controller. To redirect to /home
from flow i use externalRedirect:contextRelative:/home
in view
attribute. Is possible to pass some data to /home
in POST
?
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" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不会。
当您指定
externalRedirect:
时,Spring Webflow 将在您的响应中设置重定向代码和 Location 标头,这只是指示浏览器对指定位置执行 GET 请求。您可以包含附加到此位置的查询参数,但不能包含 POST 数据。例如:
另请注意,您可以在此字符串中包含 ${expressions} ,该字符串将根据请求上下文进行评估,根据 XSD。
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. You can include query parameters appended to this location but not POST data.For example:
Also note that you can include ${expressions} in this string that will be evaluated against the request context, according to the XSD.