Announcement Announcement Module
No announcement yet.
Field Validate in Spring Web Flow Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Field Validate in Spring Web Flow

    Field Validate in Spring Web Flow

    I am trying to do my field validate inside the controller of my Spring Web Flow. I have the following code inside my code and it works great if I have a error but if I dont have a error what do I return? Am I doing this the right why?

    Code in my controller:
    public Event validateVisit(Visit visit, MessageContext messageContext)
    String temp = visit.getType_of_visit() + "";
    MessageBuilder errorMessageBuilder = new MessageBuilder().error();
    messageContext.addMessage(errorMessageBuilder.buil d());
    return new EventFactorySupport().error(this);

    Here is my flow.xml
    <view-state id="SchoolVisitReport" view="SchoolVisitReport.jsp" model="visit">
    <transition on="submit" to="addVisit">
    <evaluate expression="flowActions.validateVisit(visit, messageContext)"/>
    <transition on="cancel" to="endState"/>

    <decision-state id="addVisit">
    <if test="flowActions.addVisit(visit)" then="endState" else="errorState" />

    Please let me know if I am doing this the right what.. I cant get it working if I dont have a error.