Thursday, October 2, 2008

JspException; Duplicate component id: '_id0:_id14', first used in tag: ?

Error Message:
javax.servlet.ServletException: javax.servlet.jsp.JspException: Duplicate component id: '_id0:_id14', first used in tag: 'com.sun.faces.taglib.html_basic.InputTextTag' org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)...

Analysis:
There are two components that have the same id while the JSF components are rendered. You won't necessarily find duplicate ids in your jsp source code, this problem arises very often due to the way JSP and JSF interact.

Checklist:
* If the duplicate id is one that you have created: check if there are duplicate components ids in your jsp source code, do not forget the included components.
* If you use the JSTL core tags, forEach, if, choose and when don't forget that the JavaServer Faces tags nested within these tags must have explicit identifiers. In this case you cannot rely on the generated ids.
* Check if you programmatically add components to the component tree without giving them explicit ids. If so you must give them explicit ids.
* Sometimes you only wrestle with this problem during development and it can be solved by creating a new session.

No comments: