Components missing in component tree for h:dataTable ?
Joined: May 03, 2011
I have a very basic h:dataTable definition like this
To the two h:inputText I've attached a validator :
What I want to do, is to highlight the field that failed validation with blue background. The problem is that I always get the whole column background color to blue. For instance, if I write Blue in any field in the "Color" column I got the following output
Audi Blue (the field that failed validation)
Mercedes Red (why does this get Blue ?)
Porsche Black (why does this get Blue ?)
Volkswagen Green (why does this get Blue ?)
Actually I think I know the problem, but I dont know why it behaves this way. Or how to solve it. When I look at the Component tree for the page I get this (some attributes removed to readability):
It seems there is not a Component in the Component Tree for every h:inputText I have in my view ? Why is it this way ? When I run the program I see the that the validator executes for 8 components :
From log: SEVERE: Got comp with id: carForm:carDataTable:0:brand and value Audi
SEVERE: Got comp with id: carForm:carDataTable:0:color and value Blue
SEVERE: Failed validation for compcarForm:carDataTable:0:color
SEVERE: Got comp with id: carForm:carDataTable:1:brand and value Mercedes
SEVERE: Got comp with id: carForm:carDataTable:1:color and value Red
SEVERE: Got comp with id: carForm:carDataTable:2:brand and value Porsche
SEVERE: Got comp with id: carForm:carDataTable:2:color and value Black
SEVERE: Got comp with id: carForm:carDataTable:3:brand and value Volkswagen
SEVERE: Got comp with id: carForm:carDataTable:3:color and value Green
...but I cant see them in the Component tree ? Is there a way to force JSF to render Components and add them to the Component Tree ? Othwervise I cant see how to solve the problem.
Joined: Jan 11, 2011
If you're using JSF 2.0 there is a very easy way to style invalid components. Works great with datatables.