Announcement Announcement Module
Collapse
No announcement yet.
Help with a Flow with two FormAction beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with a Flow with two FormAction beans

    I'm brand new to WebFlow (isn't everyone?), and am working through a fairly simple flow. I'm having a little trouble and any direction is appreciated.

    Essentially, the goal of this flow is to create or edit a FieldType instance. FieldType has a List of FieldTypeAttributes.

    Thus far, I have only two views. The first shows the form for editing the properties of the FieldType. The second view is used to add a new FieldTypeAttribute to the FieldType's list of attributes.

    Since I have two forms, I have two FormActions. The FieldTypeAction is responsible for setting up the form, binding and persisting a FieldType. The FieldTypeAttributeAction is responsible for setting up the form for a FieldTypeAttribute and binding the form fields to the FieldTypeAttribute.

    As you can see in the flow below, the newAttribute event binds the FieldType instance to the request parameters submitted from the web form and then calls the 'setupForm' method on the FieldTypeAttributeAction.

    A problem presents itself after the details for the FieldTypeAttribute are entered into the form and the submit button is clicked. The 'finishAttribute' action state calls for the 'submit' method to be invoked on the FieldTypeAttributeAction bean, but instead the 'submit' method is invoked on the FieldTypeAction.

    So my question is: Why is submit being invoked on the FieldTypeAction and not the FieldTypeAttributeAction, as I have defined? Have I set this up properly? What am I doing right, and what am I doing wrong? Looking through the examples and the docs haven't made things clearer for me.

    Please Help!


    Here's my current flow:
    Code:
    <webflow id="fieldTypeFlow" start-state="setupForm">
    
        <action-state id="setupForm">
            <action bean="fieldTypeAction" method="setupForm"/>
            <transition on="success" to="showTypeForm"/>
            <transition on="error" to="tryAgain"/>
        </action-state>
    
        <view-state id="showTypeForm" view="EditFieldType">
            <transition on="startOver" to="cancel"/>
            <transition on="newAttribute" to="bind"/>
            <transition on="submit" to="finish"/>
        </view-state>
    
        <action-state id="bind">
            <action bean="fieldTypeAction" method="bindAndValidate"/>
            <transition on="success" to="newAttribute"/>
            <transition on="error" to="showTypeForm"/>
        </action-state>
    
        <action-state id="newAttribute">
            <action bean="fieldTypeAttributeAction" method="setupForm"/>
            <transition on="success" to="showAttributeForm"/>
            <transition on="error" to="tryAgain"/>
        </action-state>
    
        <view-state id="showAttributeForm" view="EditFieldTypeAttribute">
            <transition on="cancel" to="showTypeForm"/>
            <transition on="submit" to="finishAttribute"/>
        </view-state>
    
        <action-state id="finishAttribute">
            <action bean="fieldTypeAttributeAction" method="submit"/>
            <transition on="success" to="addAttribute"/>
            <transition on="error" to="showAttributeForm"/>
        </action-state>
    
        <action-state id="addAttribute">
            <action bean="fieldTypeAction" method="addAttribute"/>
            <transition on="success" to="showTypeForm"/>
            <transition on="error" to="showAttributeForm"/>
        </action-state>
    
        <action-state id="finish">
            <action bean="fieldTypeAction" method="submit"/>
            <transition on="success" to="displayConfirmation"/>
        </action-state>
    
        <end-state id="displayConfirmation" view="ViewFieldType"/>
    
        <end-state id="tryAgain" view="TryAgain"/>
    
        <end-state id="cancel" view="Home"/>
    
    </webflow>
    The debug output for the 'finishAttribute' action state:
    Code:
    2005-06-27 11&#58;50&#58;39,741 org.springframework.web.flow.ActionState &#91;http-8080-Processor23&#93; DEBUG  Entering state 'finishAttribute' in flow '&#91;Flow@d69ffc id = 'fieldTypeFlow'...&#93;'
    
    2005-06-27 11&#58;50&#58;39,757 org.springframework.web.flow.execution.FlowExecutionListenerList &#91;http-8080-Processor23&#93; DEBUG  Publishing state entering event to 0 listener&#40;s&#41;
    
    2005-06-27 11&#58;50&#58;39,761 org.springframework.web.flow.execution.impl.FlowSessionImpl &#91;http-8080-Processor23&#93; DEBUG  Setting current state of this 'fieldTypeFlow' flow session to '&#91;ActionState@d91fa4 id = 'finishAttribute', flow = 'fieldTypeFlow', actions = set&#91;&#91;AnnotatedAction@1de7b2 action = com.leadconduit.web.spring.webflow.FieldTypeAction@5f222b, properties = map&#91;'method' -> 'submit'&#93;&#93;&#93;...&#93;'
    
    2005-06-27 11&#58;50&#58;39,762 org.springframework.web.flow.execution.FlowExecutionListenerList &#91;http-8080-Processor23&#93; DEBUG  Publishing state entered event to 0 listener&#40;s&#41;
    
    2005-06-27 11&#58;50&#58;39,764 org.springframework.web.flow.ActionState$ActionExecutor &#91;http-8080-Processor23&#93; DEBUG  Executing action '&#91;AnnotatedAction@1de7b2 action = com.leadconduit.web.spring.webflow.FieldTypeAction@5f222b, properties = map&#91;'method' -> 'submit'&#93;&#93;'

  • #2
    Re: Help with a Flow with two FormAction beans

    Originally posted by akw
    Why is submit being invoked on the FieldTypeAction and not the FieldTypeAttributeAction, as I have defined?
    Because my servlet context was defining the fieldTypeAttributeAction bean as an instance of class FieldTypeAction, not FieldTypeAttributeAction.

    Comment

    Working...
    X