File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why does UICompoent.getCurrentComponent sometimes return the parent of the current component?
 
Similar Threads
dynamic JSF components question
programmatic HTmlCommandLink action with parameters not working
A more dynamic way of accessing property values? (Like a "property bag"?)
Need help in dynamic forms
Apache Commons Validator: Working With Arrays