| Author |
Difference between UIComponent getId and getClientId(FacesContext)
|
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Joined: Aug 26, 2006
Posts: 4967
|
|
I'm just wondering what the difference is between the getId() and getClientId(FacesContext) method of the UIComponent?
I guess the getClientId() 'generates an id if one does not exist.' Is that the big diff? Can't we expect every component to already have an id? I'm thinking especially during the validation or conversion phase. If a UIComponent is being validated, it's already been rendered at least once, so it would have to have an id, right?
JSF 1.2 UIComponent JavaDoc
|
Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
|
 |
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Joined: Aug 26, 2006
Posts: 4967
|
|
Well, when used in the validation method, if you want the <h:message for="xyz"/> tag to work, you need to use getClientId(xxx)
It seems getId() just generated the name that might be used in the tag, where the getClientId gets the fully qualified name.
text.getClientId --> rpsgameform:gesture
text.getId --> gesture
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14568
|
|
|
Kito Mann mentioned that fact in his JSF in Action book.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
 |
|
|
subject: Difference between UIComponent getId and getClientId(FacesContext)
|
|
|