This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum 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
Register / Login


JavaRanch » Java Forums » Java » JSF
Reply 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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Why does UICompoent.getCurrentComponent sometimes return the parent of the current component?
 
Similar Threads
Apache Commons Validator: Working With Arrays
Need help in dynamic forms
A more dynamic way of accessing property values? (Like a "property bag"?)
programmatic HTmlCommandLink action with parameters not working
dynamic JSF components question