1

I'm getting a duplicate id error but I can't figure out which element is meant.

java.lang.IllegalStateException: duplicate Id for a component pb_1_WAR_TEST_INSTANCE_1234_:_viewRoot:mainForm:tableOverview:j_id66

I know it has to be in tableOverview but the element with the ID: j_id66 can not be found. When I search for it in my browser, I can only find elements with higher Id's like,

pb_1_WAR_TEST_INSTANCE_1234_:_viewRoot:mainForm:tableOverview:j_id67

Is there any way to find out which one is meant?

Tiny
  • 27,221
  • 105
  • 339
  • 599
MadMax
  • 68
  • 6
  • 1
    It's likely a column component. As to the problem, are you using `binding` attribute to bind a component to a bean which is not in the request scope? That's one of most common mistakes causing this problem. – BalusC Aug 11 '15 at 14:08
  • @BalusC ok, I kicked out all binding tag's and replaced them. I understand that binding is evil in session scope as you have written here: [link](http://stackoverflow.com/a/14917453/5146922) But is there a way to debug this automaticaly created id's? – MadMax Aug 12 '15 at 08:29

1 Answers1

0

It's most likely a <h:column> or <rich:column>.

Quick way to find out the exact component is findComponent():

UIComponent component = context.getViewRoot().findComponent("pb_1_WAR_TEST_INSTANCE_1234_:_viewRoot:mainForm:tableOverview:j_id66");
System.out.println(component); // HtmlColumn?

Alternatively, just print out the JSF component tree. JSF 2.x offers <ui:debug> for this, in JSF 1.x you have to write custom code which traverses and prints UIViewRoot and all its children recursively. Here's a kickoff example:

public static void print(UIComponent component) {
    System.out.println(component.getId() + " = " + component.getClass());
    for (UIComponent child : component.getChildren()) {
        print(child);
    }
}
print(context.getViewRoot());

As to your concrete problem, it's most likely caused by binding a component to a bean which is not in the request scope. Don't do that.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555