Did you ever need to set a focus on a particular component after a request? In RichFaces, you can set the focus attribute to point to an id of a component to which focus should be set after the request. All components that send an Ajax request to the server have this attribute. Using it is very simple, here is an example:
1 2 3 4 5 6 7 8
<h:form> <rich:panel> <h:panelGrid> <a4j:commandLink value="Set Focus" focus="text" /> <h:inputText value="Hello" id="text" /> </h:panelGrid> </rich:panel> </h:form>
After you click Set focus button, focus will be set on to the ‘text’ component. Obviously in a real application you would be invoking an action listener of some sort but this is just an example.
Pretty neat and easy!