子流程调用在 Spring webflow 中不起作用

Subflow invocation not working in Spring webflow

我正在 Spring 创建一个 ShoppingCart 应用程序 mvc.Here 我现在有两个流程。

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

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

我的父流程是 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'"/>