previous | index | next

Immediate Command Components

Here is an application that uses command links to change locale.

If any of the input fields has a required validator, the same problem of an unwanted validation message would occur when clicking a flag.

Command components, such as h:commandButton and commandLink, can have immediate attributes, with the same desired effect:

     <h:commandLink action="#{localeChanger.germanAction}" immediate="true">
        <h:graphicImage value="/german_flag.gif" style="border: 0px"/>
     </h:commandLink>

Unlike value change events, we do not need to modify our listener to invoke FacesContext.renderResponse(), because all actions, immediate or not, proceed directly to the Render Response phase, regardless of when they are fired.


previous | index | next