myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Lessard" <>
Subject [JSF 2.0] UIComponent.getCurrentComponent behavior
Date Thu, 15 Jan 2009 00:33:25 GMT
Hi all,

The JavaDoc for UIComponent.getCurrentComponent says:

"Return the UIComponent instance that is currently processing. This is
equivalent to evaluating the EL expression "#{component}" and doing a
getValue operation on the resultant ValueExpression. This method must return
null if there is no currently processing UIComponent"

So, my first implementation was to do just that, call the ELResolver to
resolve #{component}. However, that processing is slower than simply
evaluating the current component being processed which is stored in the Map
attribute. The Map is already available to the class since UIComponent is in
charge of pushing and popping the current component. The only drawback I
would see to read directly from the Map is if the user add a new custom
ELResolver for #{component} to do some funky things, then the
getCurrentComponent would no longer catch that alteration.

What do you think?

~ Simon

View raw message