Announcement Announcement Module
Collapse
No announcement yet.
Spring web flow execution is not always working Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring web flow execution is not always working

    I have configured beans in the webmvc-config.xml file, and have those beans defined in my flow.xml, as follows:
    flow executes correctly only the transition on="success" to="verifyInjuredWorkerHomeAddressAction". It will not execute the "injuredWorkerEntryNextPage" tag, when that condition has been met. Anyone have any ideas?

    webmvc-config.xml file:
    <bean id="injuredWorkerEntryValidator" class="com.summitholdings.noi.web.intake.InjuredWo rkerEntryValidator">
    <property name="idNumberTypeRegistry" ref="idNumberTypeRegistry" />
    <property name="injuredWorkerEntryValidatorAction" ref="injuredWorkerEntryValidatorAction" />
    </bean>
    <bean id="injuredWorkerEntryValidatorAction" class="com.summitholdings.noi.web.intake.InjuredWo rkerEntryValidatorAction" />

    flow.xml:

    <view-state id="injuredWorkerEntryNextPage" view="internalIntake/injuredWorkerEntryNextPage" model="injuredWorkerEntry">
    <on-render>
    <evaluate expression="injuredWorkerEntry.calculateDisability Date(submission)" />
    </on-render>
    <transition on="next" to="injuredWorkerEntryValidatorAction" />
    <transition on="previous" to="injuredWorkerEntry" validate="false" />
    </view-state>

    <action-state id="injuredWorkerNextPageErrorState">
    <evaluate expression="injuredWorkerEntryValidatorAction.setE rrorsExistMessage(flowRequestContext)" />
    <transition to="injuredWorkerEntryNextPage" />
    </action-state>

    <!-- check for errors on page -->
    <action-state id="injuredWorkerEntryValidatorAction">
    <evaluate expression="injuredWorkerEntryValidatorAction.vali date()" />
    <transition on="success" to="verifyInjuredWorkerHomeAddressAction" />
    <transition to="injuredWorkerNextPageErrorState" />
    </action-state>


    InjuredWorkerEntryValidatorAction.java

    package com.summitholdings.noi.web.intake;

    import javax.annotation.Nonnull;

    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.binding.message.MessageBuilder ;
    import org.springframework.binding.message.MessageContext Errors;
    import org.springframework.binding.message.MessageResolve r;
    import org.springframework.validation.Errors;
    import org.springframework.webflow.execution.RequestConte xt;

    public class InjuredWorkerEntryValidatorAction {

    private static final Logger logger = LoggerFactory.getLogger(InjuredWorkerEntryValidato rAction.class);
    private Errors errors;

    public void setErrors(Errors errors) {
    this.errors = errors;
    }
    public String validate()
    {
    return errors.getErrorCount() > 0 ? "errors" : "success";
    //return requestContext.getMessageContext().hasErrorMessage s() ? "errors" : "success";
    }
    /**
    * Adds the "errors exist on page" message to the current context.
    * @param requestContext The current request context.
    * @since 0.30.0
    */
    public void setErrorsExistMessage(
    @Nonnull RequestContext requestContext)
    {
    String flowName = requestContext.getActiveFlow().getId();
    MessageResolver message = new MessageBuilder()
    .error()
    .codes(new String[]{
    "flows." + flowName + ".errors.exist.on.page",
    })
    .defaultText("Errors exist on page, and must be corrected to continue")
    .build();
    requestContext.getMessageContext().addMessage(mess age);
    }
    }

  • #2
    I don't see the use of injuredWorkerNextPageErrorState action,

    you try like this
    <!-- check for errors on page -->
    <action-state id="injuredWorkerEntryValidatorAction">
    <evaluate expression="injuredWorkerEntryValidatorAction.vali date()" />
    <transition on="success" to="verifyInjuredWorkerHomeAddressAction" />
    <transition on="errors" to="injuredWorkerEntryNextPage">
    <evaluate expression="injuredWorkerEntryValidatorAction.setE rrorsExistMessage(flowRequestContext)" />
    </transition>

    </action-state>

    Comment

    Working...
    X