java - Spring webflow 遇到问题

标签 java spring jakarta-ee spring-webflow

我正在尝试向此 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/

相关文章:

java - Tomcat Postgres 连接

java - antlr 生成的 java 代码未触发方法

java - 如何在 Resilience4j Spring starter 中配置事件

java - Spring Webflow 最佳实践

java - 在整个 Spring MVC/JSP 应用程序中显示导航栏

java - 在Eclipse上配置J2EE版本

java - 从 html 调用 Rest Web 服务..传递凭据

java - 为什么他们在从输入流读取时使用 "while"语句?

java - 如果存在特定键 Java 8 的值,则检查列表映射

eclipse - Java maven开发速度慢