GeeCON Prague 2014*
The moose likes JSF and the fly likes Why does UICompoent.getCurrentComponent sometimes return the parent of the current component? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "Why does UICompoent.getCurrentComponent sometimes return the parent of the current component?" Watch "Why does UICompoent.getCurrentComponent sometimes return the parent of the current component?" New topic
Author

Why does UICompoent.getCurrentComponent sometimes return the parent of the current component?

Jason Irwin
Ranch Hand

Joined: Jun 09, 2009
Posts: 327
According to the API docs, UIComponent.getCurrentComponent(FacesContext) should return the UICompnoent that is currently processing. Unfortunately it is not doing this, or I am not understanding why it returns the component I am seeing. I am using JSF 2.0, Mojarra.

I have a very simple form:

The backing bean has the relevant getter and setter:

As I have stated in the comments, "UIComponent.getCurrentComponent" does not consistently return the "inputText", it quite often returns the "panelGrid". I totally understand that the "panelGrid" will be restored during the Faces lifecycle, but it is not bound to "[get|set]AttrValue", only the "inputText" is.

Why am I seeing "panelGrid" as the current component in the "[get|set]AttrValue"?


SCJP6
 
GeeCON Prague 2014
 
subject: Why does UICompoent.getCurrentComponent sometimes return the parent of the current component?