views:

906

answers:

1

I am not clear on the difference between these two methods. I see that the actionListener takes an ActionEvent as a parameter, but both may be tied to a method in the backing bean.

Is the only functional difference the ActionEvent parameter? So if I need ActionEvent use the listener method, if not, either will work?

+3  A: 

actionListener takes an ActionEvent as the Parameter and returns void. Action takes no parameters and returns a String which can be used for navigation.

If you don't need the ActionEvent, and don't need to navigate, you can generally do either one. If you do need the ActionEvent, you need actionListener. If you do need to navigate, then you need the action.

jsight