Announcement Announcement Module
Collapse
No announcement yet.
Form object "reverts" to a previous version following a particular path Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Form object "reverts" to a previous version following a particular path

    In the "middle" of a flow, I am reusing a JSP ("receptionForm" view below) from another part of the project which is pretty complex and cannot handle binding. So I disabled binding for this flow and I call the bindings methods when necessary.

    Xml goodness
    HTML Code:
    ...
    	<view-state id="pre-integration" view="integrationPre">
    		<transition on="prepQuest" to="prepQuest" />
    		<!-- some other irrelevant transitions -->
    	</view-state>
    	
    	<action-state id="prepQuest">
    		<action bean="IntegrationController" method="prepQuest" />
    		<transition on="success" to="quest" />
    		<!-- idem -->
    	</action-state>
    	
    	<view-state id="quest" view="receptionForm">
    		<transition on="remplir" to="comparer" />
    		<!-- idem -->
    	</view-state>
    	
    	<action-state id="comparer">
    		<action bean="IntegrationController" method="comparer" />
    		<!-- some transitions which i never get to -->
    	</action-state>
    ...
    The problem happens when I hit the "comparer" action-state. First thing i do in the corresponding action is get the formObject, but it's already back to the state of the "pre-integration" view-state (and *not the state of a new object created by invoking the constructor), even if I did modify it in prepQuest().

    Some relevant code

    Code:
    public class IntegrationController extends FormAction {...
    Code:
    public IntegrationController() {
    		super();
    		setFormObjectClass(IntegrationForm.class);
    		setFormObjectName("form");
    		setFormObjectScope(ScopeType.FLOW);
    	}
    Code:
    @Override
    protected boolean setupBindingEnabled(RequestContext context) {
    	return false;
    }
    Code:
    public Event prepQuest(RequestContext context) throws Exception {
    	this.bindAndValidate(context);
    	IntegrationForm intf = (IntegrationForm) getFormObject(context);
    	//Some logic to modify the form object...
    	intf.setThis() intf.setThat();
    	return success();}

    Here is the dubious code which doesn't work like expected:

    Code:
    IntegrationForm intf = (IntegrationForm) getFormObject(context);
    //http://opensource.atlassian.com/confluence/spring/display/WEBFLOW/Frequently+Asked+Questions#FrequentlyAskedQuestions-ImplementingActions	
    HttpServletRequest request = ((ServletExternalContext)context.getExternalContext()).getRequest();
    here intf has the state of the beggining of prepQuest() method.

    Any insight on what is causing this madness would be appreciated.
    (Don't make any assumptions, I'm not an advanced spring/swf programmer)

  • #2
    I found it

    I found the totally unrelated solution. The form object was Serializable, but the parent class was not serializable, so its fields were not saved. It clearly gave the impression that the object reverted to a previous state because I only set properties of the parent class on the second flow action-state.

    Comment

    Working...
    X