If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

The 'action' attribute of the <form> tag tells the browser what action to take when the user "submits" the form. It is the same as the 'href' attribute of the <a>nchor tag, and should contain the URL/URI of the resource (script or page) to be used to process the user's submission. If empty or missing, the default value is the current page - that is, the form is "submitted" to the page itself, which is reloaded. Your example where the 'action' attribute is set to "?" would mean the the form would be submitted to the current page with an empty (or invalid) query string.

Keep in mind that the 'method' attribute of the <form> tag determines how the form data is transmitted to the URI pointed to by the 'action' attribute. It can be either 'GET' (the default) or 'POST'. If the form uses the 'GET" method, the form data is encoded into a query string which is appended to the URI from the 'action' attribute. Your example of the 'action' attribute being set to '?' would end up creating an invalid query string. Finally, if the form uses the 'POST' method, the form data is incorporated into the HTTP request sent to the URI pointed to by the 'action' attribute.

Use actionListener if you want have a hook before the real business action get executed, e.g. to log it, and/or to set an additional property (by <f:setPropertyActionListener>), and/or to have access to the component which invoked the action (which is available by ActionEvent argument). The actionListener method is required to have the following signature:

Use action if you want to execute a business action and if necessary handle navigation. The action method can return a String which will be used as navigation case outcome (the target view). The action method can be any valid MethodExpression, also the ones which uses EL 2.2 arguments, e.g:

<h:commandLink value="submit" action="#{bean.edit(item)}" />
with

public void edit(Item item) {
// ...
}
The actionListeners are always invoked before the action in the order they are been declared in the view. So, the following example

Another subtle difference is that the actionListener swallows any exceptions and won't propagate it up (i.e. you won't see an error/exception page, JSF will log them however). This is done so because the business logic, exception handling and navigation handling job is up to the action method.