This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why does UICompoent.getCurrentComponent sometimes return the parent of the current component?
 
Similar Threads
programmatic HTmlCommandLink action with parameters not working
Need help in dynamic forms
A more dynamic way of accessing property values? (Like a "property bag"?)
Apache Commons Validator: Working With Arrays
dynamic JSF components question