When I create a web-based user interface I tend to is a fanatic about making sure that the first input field on a form get s input focus when the form is first displayed. It always drives me crazy if I go to a Web form this requires text input, but the developer of the page hasn ' t taken the Time to put the default focus in the first field of the form.
So ... after looking around @ some html/jsf/struts/jsp code I ' ve written over the last few years, the following JSF Examp Le shows the most concise-I know of setting default input focus on an HTML form field:
In this example I use the
Syntax to put the default input focus in the TextField named contact_add:contact_name
. When using JSF, this is the name of the JSF ends up applying to my "first name" TextField. In your code just use the name of the your HTML component.
How to set the default input focus on a field in an HTML Web Form