【问题标题】:The attribute update is not defined in the component commandButton组件commandButton中没有定义属性更新
【发布时间】:2013-02-25 14:43:00
【问题描述】:

我有这个 JSF commandButton,用于从表中删除行:

<h:commandButton id="deleterow" value="HiddenDelete"  action="#{BatteryProfileTabGeneralController.saveData}" style="display:none" update="growl">
    <f:ajax render="@form" execute="@form"></f:ajax>
</h:commandButton>

在 Netbeans 7.3 中出现此错误:

The attribute update is not defined in the component commandButton

当我成功删除行时,我使用update 属性来显示消息。我可以用相似的属性替换这个属性吗?

【问题讨论】:

  • update 是一个 primefaces only 属性,不能用于现有的 JSF 组件(比如你那里的 &lt;h:commandButton/&gt;)。 &lt;f:ajax/&gt; 上的render 属性应该足以达到预期的效果

标签: jsf jsf-2


【解决方案1】:

update 属性特定于 PrimeFaces &lt;p:commandButton&gt;。它是标准 JSF 等效 &lt;f:ajax render&gt; 的便捷替代品。

所以,基本上,&lt;p:commandButton ... update="growl" /&gt; 与以下内容基本相同:

<h:commandButton ...>
    <f:ajax render="growl" />
</h:commandButton>

请注意,当&lt;p:growl id="growl"&gt; 不在同一个表单中时,您应该使用绝对客户端 ID 来引用它,也许是&lt;f:ajax render=":growl"&gt;。如果您还想更新当前表单,请使用&lt;f:ajax render="@form :growl"&gt;。这可能是您的情况,因为您目前已经是 render="@form",但仍然不断询问是否明确更新咆哮,这表明它实际上根本没有包含在表单中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-07
    • 2015-01-02
    • 2012-02-08
    • 1970-01-01
    • 2013-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多