【问题标题】:action-state not accept evaluate tags Spring Web Flow 2.3动作状态不接受评估标签 Spring Web Flow 2.3
【发布时间】:2014-07-09 20:32:05
【问题描述】:

Eclipse 标记此错误

cvc-complex-type.2.4.a:发现以元素“action-state”开头的无效内容。 '{"http://www.springframework.org/schema/webflow":on-end, "http://www.springframework.org/schema/webflow":output, "http://www.springframework.org/schema/webflow":exception-handler, "http://www.springframework.org/schema/webflow":bean-import}' 之一是预期的。

关于这个流程代码

<?xml version="1.0" encoding="UTF-8"?>
<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" 
abstract="true">


<global-transitions>
    <transition on="logIn" to ="login" />
    <transition on="signup" to="signup"/>
    <transition on="logOut" to="logout"/>
</global-transitions>

<action-state id="logout">
    <evaluate expression="login.logout(currentUser)" />
    <transition on="successLogout" to="main" />
    <transition on="failLogout" to="error" />
</action-state>

我只找到动作状态示例,每个人都在写我的代码,而且人们使用相同的 XSD。要么,我已经阅读了 XSD 文件,并且在动作状态部分标记评估丢失。为什么eclipse会标记这个错误?

提前致谢!

【问题讨论】:

  • 现在,我已经编辑了,因为我复制了错误的代码,对不起 :)

标签: eclipse spring spring-mvc spring-webflow-2


【解决方案1】:

我认为元素的定义必须有一个顺序。尝试在global-transitions 之前定义action-state。如果您将鼠标指针悬停在 xml 文件中的“流”xml 定义上,则会出现此信息(以及其他信息):

Content Model : (attribute*, secured?, persistence-context?, var*, input*, on-start?, (action-state | view-state | decision-state | subflow-state | end-state)*, global-transitions?, on-end?, output*, exception-handler*, bean-import*)

所以,有一个strict sequence

【讨论】:

  • 并且上面“内容模型”中的所有元素都定义在xsd:sequence中。
  • 干杯!问题已解决,您的链接对我有所帮助,因为我在阅读任何 XSD 文件时有点困惑:)
  • 酷:-)。有时检查 xsd 并查看 xml 的预期内容很有用。
猜你喜欢
  • 2016-06-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-08-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多