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

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Mon, 29 Oct 2007 21:46:46 -0700

Mark Collette wrote:
> Ryan Lubke wrote:
>> Mark Collette wrote:
>>> 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 may be missing something here, but I don't see the value of a
>> getAttributes() and a getValueExpression(). getAttributes().get()
>> will check the the PropertyDescriptors for the component, the
>> internal attributes, and value expressions.
> Ahh yes, perfect, UIComponentBase.AttributesMap.get(Object) checks the
> ValueExpression :)
> Should I still file a bug report, or will you, with your code change
> idea?
Ok, as odd as it looks, the code as it exist now is correct.

Consider a simple page using f:loadBundle for a custom resource.
We've initiated a post-back, and a conversion error has occurred.

At the time that the conversion error is being processed, the bundle
from loadBundle hasn't been pushed into the request scope,
so component.getAttributes().get("label") returns an empty String.

So the logic returns a the ValueExpression itself to be evaluated
when the page renders (after the bundle has been pushed into scope).

> - Mark Collette
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail: