我正在尝试向此 XML 添加一个 on-render
元素:
<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>
我尝试将其添加到 view-state
元素中,但是当我这样做时,页面崩溃了。这是异常(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.
我正在使用 Spring webflow 2.0.8。
最佳答案
WebFlow XSD指定任何 <binder>
元素必须位于任何 <on-render>
之前元素。您收到的异常消息是因为您的 on-render
元素出现在 <binder>
之前元素。我建议您使用支持 XSD 的编辑器来编辑 XML 文件,并在 XML 声明中包含 webflow XSD:
<?xml version="1.0"?>
<flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
start-state="startState">
...
</flow>
关于java - Spring webflow 遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14356957/