0

I'm using google app engine with JSF. i want to call a function when user press that button:

<p:commandButton value="Ajax Submit" action="#{todo.test}" /> 

and I put todo under src->package test123.

package test123;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.ActionEvent;


@ManagedBean(name="todo")
@SessionScoped
public class Todo {  

    public void test(ActionEvent event){ 
  System.out.println("lol");    
    }
}  

but when i press button, error occurs: sth like this:

 javax.el.MethodNotFoundException: /Template/default.xhtml @39,38 action="#{todo.test}": Method not found: test.Todo@7929b073.test()

am i wrong? or do i need to do some configurations ?

Thanks

Mario
  • 855
  • 4
  • 19
  • 30

1 Answers1

2

Use actionListener="#{todo.test}" or try:

public void test()
{ 
  System.out.println("lol");    
}

See here for more details: Differences between action and actionListener

Community
  • 1
  • 1
Thor
  • 6,607
  • 13
  • 62
  • 96
  • Hi @Thor, it works!! but why? I thought it should be an action event, right? – Mario May 25 '12 at 06:02
  • 1
    you are welcome. Do not confuse these two tags, actions is used to perform business logic and navigation task; while action listeners are used to perform UI interface logic or action invoke observation. – Thor May 25 '12 at 06:11