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 thoughts on “RichFaces focus attribute

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s