Duplicate ids arise because of the manner in which JSP and JSF interact. Two typical scenarios for this error are when you are conditionally specifying components inside <c:if> or <c:choose>, or when you programatically add components to the component tree without giving them explicit ids.
Here is an article that explains what the discontinuities are between JSF and JSP. Rather than trying to troubleshoot your problem here in the forum, skim over that article and see if anything pertains to your situation.
I too got this error once. I was modifying the ID of command link component from the backing bean, and the child element of command link i.e. an outputText component started giving me this error.
I put whole of this bunch inside a datatable, the error was gone. :roll:
posted 15 years ago
Thanks Geary.. i have not read the document before....
But this behaviour is also observed when I suppose this is not the JSP and JSF rendering issue. Consider this scenario:
I have a JSP test.jsp with a datatable dtable binded to a backing bean element testTable in bean Test.java. This table contains a collection of command links in it. It also has a Update button which updates some values. On click of Update it opens a new update pop up Dialog.
Now Update Dialog has a JSP say updateTest.jsp using the same bean Test.Java from session. It also has another Table updateTable mapped to the same backing bean element testTable. Now if you use any command link in this table it always give you the Duplicate ID exception.
In this scenario - JSP's are different, all Command Links are also bound by a data table, but the bean is same. The reason for keeping the same bean is that both update and test jsp has the same fields.
The problem eliminates if I use a different binding element to table -- say updateTable in the Bean, or if I remove the command links. It only gives problem when you use command links inside a table. It works fine for Input Text and Output Text.
I hope the problem is clear to you...
Thanks in Advance,<br /> <br />SM
posted 15 years ago
If you can carve out a small code sample that illustrates the problem, I'll take a look.