Friday 9 October 2009

JSF: working with component identifiers (id/clientId)

This is a post about how to work with IDs in JavaServer Faces. You may find this useful if you want to use JavaScript with JSF.

Example ID developer sets on a JSF component:  foo1
What JSF might render in the resultant HTML:   j_id_jsp_115874224_691:table1:0:foo1

This is a revised version of JSF: working with component IDs (id vs clientId), though you don't need to read that. This post fixes some of the issues with the code, provides a more robust version of the library and details how to use it to make simpler, more reliable applications. The target JSF version is 1.2.