You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Kenji Nagahashi (JIRA)" <de...@myfaces.apache.org> on 2006/04/05 00:04:45 UTC

[jira] Commented: (MYFACES-603) duplicate id exception

    [ http://issues.apache.org/jira/browse/MYFACES-603?page=comments#action_12373187 ] 

Kenji Nagahashi commented on MYFACES-603:
-----------------------------------------

I believe I hit exactly the same issue, and spot the cause.
UIData stores datamodel in a Map using parent's clientId as a key. If UIData is a direct child of UIViewRoot, it uses UIViewRoot's clientId, which is null. But UIComponentBase.getClientId() automatically assigns new Id if clientId == null (and emits the WARNING message). This happens during rendering and changes the order of Id assignment between 1st and 2nd request, then causes the duplicate ids exception.
IMHO, as commented in UIComponentBase.getChildId(), automatic id assignment should be disabled, at least for UIViewRoot. I will post an ad-hoc fix for this problem.

> duplicate id exception
> ----------------------
>
>          Key: MYFACES-603
>          URL: http://issues.apache.org/jira/browse/MYFACES-603
>      Project: MyFaces Core
>         Type: Bug

>   Components: General
>     Versions: 1.1.0
>  Environment: Tomcat 5.5.9, JDK 1.4.2, Windows NT
>     Reporter: Boris Klug
>     Priority: Minor

>
> When reloading a page, I get the exception below.
> I search the mailing list and someone suggested to assign a id by hand
> to every component - which is much work and would clumber the jsf pages.
> I manualy added an id to the component with the duplicate id and
> redeployed the app - now I get the exception from another component. So
> what changed from 1.0.9m9 to 1.1.0 related to this problem?
> Another strange thing is that I get the following warning:
> 2005-09-20 15:06:39,481 INFO [/XXX]: WARNING: Component _id12 just got
> an automatic id, because there was no id assigned yet. If this component
> was created dynamically (i.e. not by a JSP tag) you should assign it an
> explicit static id or assign it the id you get from the createUniqueId
> from the current UIViewRoot component right after creation!
> Everything went away after I rearragned the components like this: 
> Original:
> <f:view>
>    .. jscookmenu
>    ... dataTable with command links
>    <h:form>
>       ... more dataTable with more command links
>    </h:form>
> </f:view>
> Now without problems:
> <f:view>
>    ... jscookmenu
>    <h:form>
>       ... dataTable with command links
>       ... more dataTable with more command links
>    </h:form>
> /f:view>
> === Thrown exception ====
> 2005-09-20 15:06:47,753 ERROR [jsp]: Servlet.service() for servlet jsp threw exception
> javax.faces.FacesException: cannot add component with id '_id21' and path : {Component-Path : [Class:
>  javax.faces.component.html.HtmlInputText,Id: _id21]} to its parent component.
>  This might be a problem due to duplicate ids.
>  at  javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:401)
>  at  javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:219)
> at org.apache.jsp.templates.generic_jsp._jspx_meth_h_inputText_1(org.apache.jsp.templates.generic_jsp:1642)
> at org.apache.jsp.templates.generic_jsp._jspx_meth_h_panelGrid_4(org.apache.jsp.templates.generic_jsp:1598)
> at org.apache.jsp.templates.generic_jsp._jspService(org.apache.jsp.templates.generic_jsp:636)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
> at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira