dev@javaserverfaces.java.net

Re: javax.faces.component.MessageFactory.getLabel(FacesContext,UIComponent)

From: Mark Collette <mark.collette_at_icesoft.com>
Date: Mon, 29 Oct 2007 14:22:10 -0600

-------------
Most likely, yes.

String label = (String) component.getAttributes().get("label");
if (label == null || label.length() == 0) {
   label = component.getClientId(context);
}
return label;

(I think it makes sense to introduce a signature change as well)

I think the above would be sufficient.
-------------

Sorry Ryan, I was using the dev-digest, so I didn't get your replies
until after I sent both of my messages.

I mostly use JSF 1.1, so I might be off with the ValueExpression stuff
here, but I believe that using both
UIComponent.getAttributes.get("label") and
UIComponent.getValueExpression("label") does have some validity. It's
really only when a UIComponent has an attribute getter method, that by
convention will access the local field and the ValueExpression, that the
UIComponent.getAttributes.get() will be sufficient. If there is no
getter method, the one would have to do both calls.

I'm approaching this from two perspectives, wanting to duplicate this
functionality for JSF 1.1 code, and wanting to make sure that the
standard JSF 1.2 code is correct and compatible. So I'm half reporting a
bug, and half seeking guidance :)

- Mark Collette