I am trying to add a on-render element to this XML:
<var name="someVariable" class="com.example.test"/>
<view-state id="frontpage" view="test/test">
<binder>
<binding property="test" required="true"/>
</binder>
<transition on="submit" to="summary">
<evaluate expression="myExpression.test()"/>
</transition>
</view-state>
I tried adding it in the view-state element, but when I do so, the page crash. This is the exception:
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content
was found starting with element ‘binder’. One of
‘{“http://www.springframework.org/schema/webflow”:transition,
“http://www.springframework.org/schema/webflow”:on-exit,
“http://www.springframework.org/schema/webflow”:exception-handler}’ is
expected.
I am using Spring webflow 2.0.8.
The WebFlow XSD specifies that any
<binder>element must come before any<on-render>element. The exception message you got is because youron-renderelement was appearing before the<binder>element. I suggest that you use an XSD-aware editor for editing XML files, and include the webflow XSD in the XML declaration: