RichFaces focus attribute

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:


   
      
         
         
      
   

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!

4 responses to “RichFaces focus attribute”

  1. […] time ago I blogged on how to set focus on a component after an Ajax request in RichFaces. As a quick review, every tag […]

  2. great tip…..thank you !!!!

  3. Thank You!

Leave a comment