Primefaces p:commandButton with action not called

前端 未结 1 1010
慢半拍i
慢半拍i 2021-02-07 12:02

I\'ve got some some troubles with Primefaces 3.2 and JSF 2.1.

My Code like this:


           


        
相关标签:
1条回答
  • 2021-02-07 12:08

    Try this

    Bean.java

    @ManagedBean
    @ViewScoped
    public class Bean {
    
        public String testButtonAction() {
            System.out.println("testButtonAction invoked");
            return "anotherPage.xhtml";
        }
    
        public void testButtonActionListener(ActionEvent event) {
            System.out.println("testButtonActionListener invoked");
        }
    
    }
    

    page.xhtml

    <p:toolbar>
      <p:toolbarGroup>
        <p:commandButton action="#{bean.testButtonAction}"/>
        <p:commandButton actionListener="#{bean.testButtonActionListener}"/>
      </p:toolbarGroup>
    </p:toolbar>
    
    0 讨论(0)
提交回复
热议问题