Subflow调用在Spring webflow

时间:2018-01-09 04:43:51

标签: java spring spring-mvc spring-webflow-2

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

  1. 注册流程(flow id = registrationFlow)
  2. MailSender Flow(流程ID = mailFlow)
  3. 当成功在DB中输入用户注册数据时,将触发mailSender流(Subflow)。

    我的父流是RegistrationFlow。

    请在下面找到Subflow调用代码:

    <!-- 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>
    

    任何人都可以找出问题???

1 个答案:

答案 0 :(得分:1)

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

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