代码之家  ›  专栏  ›  技术社区  ›  Student

有没有办法在不生成type=submit的情况下使用a4j:commandButton?

  •  0
  • Student  · 技术社区  · 6 年前

    我有两个按钮:

                            <a4j:commandButton
                                execute="@this"
                                value="clear"
                                immediate="true"
                                render=":thisForm :anotherForm"
                                action="#{myMB.clearFields}" />
    
                            <a4j:commandButton
                                value="execute"
                                type="submit"
                                action="#{myMB.executeAction}"
                                render=":anotherForm" />
    

    两个都使用type=“submit”生成输入。但我想要执行第二个按钮的键。有没有办法更改第一个按钮的类型?

    1 回复  |  直到 6 年前
        1
  •  1
  •   Kukeltje    6 年前
    <a4j:commandButton
        type="button" .../>
    

    按第一个按钮就可以了。

    类型 -要创建的按钮类型。可以是“提交”、“按钮”、“图像”和“重置”之一。如果未指定,默认值为“提交”。

    提到 component reference 更多细节。