我正试图在弹簧中返回我的主要流程,只需单击一个按钮即可从我的任何子流程返回.
当我使用<end-state>它时,只需转到上一个流程,这也是应用程序中的子流程.
有任何想法吗?
我正在使用 Spring 3.1 并希望包含 Spring Web Flow 2.3。我真正喜欢 Spring 的一件事是,您可以不使用 XML 配置,而支持使用@Configuration和@Bean注释的纯 Java 配置。
但是,我还没有找到如何以这种方式配置 Web Flow。在我的 Google 搜索中出现的文档都只涉及 XML 配置。可能吗,有人有任何指示吗?
编辑:我不是在问流定义,而是在询问webflow-config模式的替代品。目前,诸如flow-registry和 之类的配置项flow-executor必须包含在 Spring-XML 文件中,以及引用它们的流处理程序映射。
我正在为应用程序使用 Spring Webflow,我需要在“正常”webflow 验证周期之外验证模型对象。我正在使用单独的验证类:
@Component
public class MyInfoValidator {
public void validateMyInfo(MyInfoView myInfo, ValidationContext context) {
MessageContext messages = context.getMessageContext();
[snip]
}
}
Run Code Online (Sandbox Code Playgroud)
我想从我的代码的另一部分调用这个相同的验证类并验证对象,但我需要创建(或检索)一个 ValidationContext 对象。
谁能告诉我如何做到这一点?它是在某个 Webflow bean 中的某个地方浮动还是我必须从头开始创建一个?
我是 webflow 的新手,我尝试使用下面的代码,这有什么问题......
<view-state id="displayAllTasks" view="/WEB-INF/flows/jsp/displayAllTasks.jsp" model="workflowSet">
<on-render>
<set name="requestScope.state" value="requestParameters.state"/>
<evaluate expression="workflowController.getAllTasksByState(requestParameters.state)" result="viewScope.workflowSet"></evaluate>
</on-render>
Run Code Online (Sandbox Code Playgroud) 我在Spring Webflow / JSF应用程序中执行流操作(http://docs.spring.io/autorepo/docs/webflow/2.3.x/reference/html/actions.html#streaming-actions)时遇到问题。我已经看到有人使用MVC控制器解决了它,但是我想按以下方式使用它。
我正在使用Tomcat 7.01,Spring WebFlow 2.3.1和Primefaces 4.0。
问题是,当我要下载文件时,什么也没发生。该代码已执行,但在浏览器中没有任何反应。有谁知道可能出什么问题,也许是某些xml中的其他设置,...?
非常感谢!
我的动作如下:
@Component
public class PrintCSVAction extends AbstractAction {
private static final String CSV_FILENAME = "export.csv";
public Event doExecute(RequestContext context) throws IOException {
HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getNativeResponse();
response.setHeader("Content-Disposition", "attachment; filename=\"" + CSV_FILENAME + "\"");
OutputStream out = response.getOutputStream();
response.setContentType("text/csv; charset=UTF-8");
out.write(new String("blablablab\n").getBytes("utf-8"));
out.flush();
out.close();
context.getExternalContext().recordResponseComplete();
return success();
}
}
Run Code Online (Sandbox Code Playgroud)
我在视图状态内的过渡定义如下:
<view-state id="search" view="export.xhtml">
<transition on="home" to="finish" />
<transition on="printCSV">
<evaluate expression="printCSVAction" />
</transition>
</view-state>
Run Code Online (Sandbox Code Playgroud)
和执行动作的命令链接:
<p:commandLink action="printCSV"> …Run Code Online (Sandbox Code Playgroud) 我从反应式存储库中获取Mono<FooBar>基于它的值,我必须创建另外两个对象,使用反应式存储库保存它们,修改FooBar对象并保存它。
由于我是反应式编程的新手,我使用了以下解决方案,该解决方案有效,但我不确定我是否正确使用了反应式 API:
@Test
void createAndSave() {
Mono<FooBar> fooBarMono = findFooBar() // returns Mono<FooBar>
.map(fooBar -> {
createAndSaveLoremBar(fooBar).subscribe(); // returns Mono<LoremBar>
createAndSaveDoloremBar(fooBar).subscribe(); // returns Mono<DoloremBar>
fooBar.setActive(true);
return saveFooBar(fooBar); // returns Mono<FooBar>
}).flatMap(Function.identity());
StepVerifier.create(fooBarMono)
.expectNextMatches(Objects::nonNull)
.expectComplete()
.verify();
}
Run Code Online (Sandbox Code Playgroud)
从控制台日志:
saved lorem bar
saved dolorem bar
saved foo bar
Run Code Online (Sandbox Code Playgroud) 我正在为一些我将要开始的社交网络项目做一些研究.我之前使用的是Spring,但由于有太多选择可供选择,我暂时无法做出决定.
我想在我的视图上使用JSF2.0组件,并且据我所知,webflow是一种很好的方法,但它不是必须的.
Webflow对Spring web mvc有什么好处?我对WF的第一印象是它让事情变得太复杂了.
提前致谢
HY.
我使用执行密钥继续弹簧网络流程.(订单paypal付款),并需要从get读取查询字符串.&TokenID和&PayerID
以下是Paypal在确认付款后重定向用户的方式:
/sampleflow?execution=e1s1&_eventId=approved&token=EC5D7416956W8431713&PayerID=TN2RE8ZTH67JN
Run Code Online (Sandbox Code Playgroud)
如果eventID被批准,我的流程将重定向到付款已确认状态.这部分正在运作.我只需要以某种方式获取查询字符串参数.
有什么办法吗?
我正在从事Spring Webflow。我的应用程序中有两个Webflow,一个用于添加人员详细信息,另一个用于修改人员详细信息。两种流程都工作正常。现在,我想将参数传递给我的修改流程并访问它,以便我可以根据传递的参数预先选择一些值。在以下提到的情况下如何实现?
用户必须向服务器提交报告参数.服务器将用户重定向到URL.该URL运行Oracle Reports以生成PDF(或网页).
系统使用相对较慢的身份验证机制.但我不打算重新启动Web流,因此身份验证不应该干扰重定向.
"运行报告"按钮编码如下:
<button type="submit" id="run" name="_eventId_run">
<fmt:message key="form.button.report.run" />
</button>
Run Code Online (Sandbox Code Playgroud)
页面的其余部分将参数绑定到DAO中的映射,例如:
<form:radiobutton path="parameters['service']" class="service" value="..." />
Run Code Online (Sandbox Code Playgroud)
提交表单显示绑定变量在DAO映射中正确设置.此外,报告能够生成用于重定向的URL.
表单本身类似于:
<form:form modelAttribute="report" action="${flowExecutionUrl}"
method="post">
<fieldset>
<%-- secret tokens --%>
<tiles:insertAttribute name="hidden" />
<%-- includes the requested report form parameters --%>
<jsp:include page="${reportKey}.jsp" />
<%-- includes the aforementioned submit button %-->
<tiles:insertAttribute name="reportButtons" />
</fieldset>
</form:form>
Run Code Online (Sandbox Code Playgroud)
该流有三种视图状态:列表报告,输入参数和运行报告.最后两个是相关的:
<view-state id="parameters" model="report" view="flow/reports/parameters">
<transition on="run" to="redirect">
<evaluate expression="reportService.run(report)" result="flowScope.url" />
</transition>
</view-state>
<view-state id="redirect" view="externalRedirect:#{flowScope.url}"/>
Run Code Online (Sandbox Code Playgroud)
reportService.run(report)正在调用该方法.报告参数受到约束.返回的结果确实是正确的URL.
spring-webflow ×10
spring ×8
java ×4
spring-mvc ×4
java-ee ×1
jsf-2 ×1
jsp ×1
redirect ×1
tomcat ×1