gpt4 book ai didi

java - 子流调用在 Spring webflow 中不起作用

转载 作者:行者123 更新时间:2023-12-02 11:46:31 26 4
gpt4 key购买 nike

我正在 Spring mvc 中创建 ShoppingCart 应用程序。这里我现在有两个流程。

  1. 注册流程(流程 id=registrationFlow)
  2. MailSender 流(流 id=​​mailFlow)

当用户注册数据成功输入数据库时​​,将触发mailSender流程(子流程)。

我的父流程是 RegistrationFlow。

请找到下面的子流程调用代码:

<!-- other navigation rules of parent flow -->

<subflow-state id="mailSenderFlow" subflow="mailFlow">
<input name="userEmail" value="flowScope.regBean.userDTO.userMail"/>
<transition on="finishMailFlow" to="checkMailFlowResult" />
</subflow-state>

<decision-state id="checkMailFlowResult">
<if test="mailSender.mailConfirmation(currentEvent.attributes.mailFlowOutcome)"
then="regSuccess" else="regConfirm" />
</decision-state>

<end-state id="regSuccess" view="/WEB-INF/view/regSuccess.jsp" />

根据子流程结果,我创建了一个决策状态,它将控制 regSuccess 页面或返回 regConfirm 页面。

请找到下面的子流定义文件:

    <flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.4.xsd">

<input name="userEmail" required="true" type="java.lang.String"/>

<action-state id="mailSenderAction">
<evaluate expression="mailSender.sendEmail(userEmail)" />
<transition on="success" to="finishMailFlow" />
</action-state>

<end-state id="finishMailFlow">
<output name="mailFlowOutcome" value="mail sending done"/>
</end-state>
</flow>

现在在子流调用期间我收到以下异常:

  org.springframework.webflow.execution.FlowExecutionException: Exception  thrown in state 'mailSenderFlow' of flow 'registrationFlow'
at org.springframework.webflow.engine.impl.FlowExecutionImpl.wrap(FlowExecutionImpl.java:573)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:263)
at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:253)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
Truncated. see log file for complete stacktrace

Caused By: org.springframework.expression.spel.SpelParseException: EL1041E: After parsing a valid expression, there is still more data in the expression: 'sending'
at org.springframework.expression.spel.standard.InternalSpelExpressionParser.doParseExpression(InternalSpelExpressionParser.java:130)
at org.springframework.expression.spel.standard.SpelExpressionParser.doParseExpression(SpelExpressionParser.java:60)
at org.springframework.expression.spel.standard.SpelExpressionParser.doParseExpression(SpelExpressionParser.java:32)
at org.springframework.expression.common.TemplateAwareExpressionParser.parseExpression(TemplateAwareExpressionParser.java:73)
at org.springframework.binding.expression.spel.SpringELExpressionParser.parseSpelExpression(SpringELExpressionParser.java:96)
Truncated. see log file for complete stacktrace>

有人能解决这个问题吗???

最佳答案

尝试在您的值中使用单引号:

<output name="mailFlowOutcome" value="'mail sending done'"/>

关于java - 子流调用在 Spring webflow 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48161557/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com