Topic
  • 10 replies
  • Latest Post - ‏2013-04-03T17:39:33Z by SystemAdmin
paoloc
paoloc
545 Posts

Pinned topic "DUPLICATE COMPONENT" ERRORS ARE RECEIVED WHEN USING JSF.

‏2013-03-27T08:39:57Z |
Using Tomcat 6.35 when I change some input parameters and reload the page I recive the error:

Duplicate ID component 'form1:_id4' found in the view.

The http://www-01.ibm.com/support/docview.wss?uid=swg1PK48744 says:
To prevent collision with existing client IDs, the
com.ibm.ws.jsf.storeDynamicClientIds property must be set to
"true" in the web.xml file. For example:

<contex-param>
<description>If this property is set to true, the number
that is used to generate new client IDs is stored in the view
so that it is saved between requests.
</description>
<param-name>com.ibm.ws.jsf.storeDynamicClientIds</param-name>
<param-value>true</param-value>
</context-param>

This is true for WebSphere server.
which can be the corresponding instructions to change the web.xml for Tomcat?
To overcome the error I always press F5 but this can not be the solution at runtime.
I'm on the right track to find a solution?
Any idea?
paoloc
Updated on 2013-04-03T17:39:33Z at 2013-04-03T17:39:33Z by SystemAdmin
  • dan_darnell
    dan_darnell
    973 Posts

    Re: "DUPLICATE COMPONENT" ERRORS ARE RECEIVED WHEN USING JSF.

    ‏2013-03-27T16:36:04Z  
    Did you try adding that context-param entry to your project's web.xml? If not, slam it in there and see what happens. (Probably nothing because it appears that the fix is in WebSphere, not in the Faces implementation.)

    There also appears to be a second work-around noted in that APAR ... give an explicit 'id' to all of your components...

    "To work around the issue simply modify this:
    <hx:inputHelperSetFocus
    target="text561"></hx:inputHelperSetFocus>

    to give it an id, for example:
    <hx:inputHelperSetFocus target="text561"
    id="setFocus"></hx:inputHelperSetFocus>"

    The general Internet wisdom seems to be along these same lines ... always give your components unique ID's so that the internally generated stuff doesn't conflict.

    --Dan
  • paoloc
    paoloc
    545 Posts

    Re: "DUPLICATE COMPONENT" ERRORS ARE RECEIVED WHEN USING JSF.

    ‏2013-03-30T07:14:53Z  
    Did you try adding that context-param entry to your project's web.xml? If not, slam it in there and see what happens. (Probably nothing because it appears that the fix is in WebSphere, not in the Faces implementation.)

    There also appears to be a second work-around noted in that APAR ... give an explicit 'id' to all of your components...

    "To work around the issue simply modify this:
    <hx:inputHelperSetFocus
    target="text561"></hx:inputHelperSetFocus>

    to give it an id, for example:
    <hx:inputHelperSetFocus target="text561"
    id="setFocus"></hx:inputHelperSetFocus>"

    The general Internet wisdom seems to be along these same lines ... always give your components unique ID's so that the internally generated stuff doesn't conflict.

    --Dan
    Hi Dan,
    I cannot found the cause of the error.
    All fields are created with drag and drop from the palette.All fields have an ID.
    The page works well if I press F5 between the displays are sended to the server.
    How to debug? what to do?

    paoloc
  • SystemAdmin
    SystemAdmin
    6195 Posts

    Re: "DUPLICATE COMPONENT" ERRORS ARE RECEIVED WHEN USING JSF.

    ‏2013-04-02T07:31:27Z  
    • paoloc
    • ‏2013-03-30T07:14:53Z
    Hi Dan,
    I cannot found the cause of the error.
    All fields are created with drag and drop from the palette.All fields have an ID.
    The page works well if I press F5 between the displays are sended to the server.
    How to debug? what to do?

    paoloc
    The view may contain components that do not have a counterpart in the UI; hence, it is not always possible to provide an explicit ID for all components in a view.

    We have experienced similar issues and in our case the culprit was the (well documented) discrepancy between JSP and JSF life cycles. Have you tried identifying the problematic component with JST Trace?

    BTW, in my experience, dragging components from the palette does not guarantee flawless jsp-code. You should check the resulting code manually (and understand its details).
  • paoloc
    paoloc
    545 Posts

    Re: "DUPLICATE COMPONENT" ERRORS ARE RECEIVED WHEN USING JSF.

    ‏2013-04-02T17:41:08Z  
    The view may contain components that do not have a counterpart in the UI; hence, it is not always possible to provide an explicit ID for all components in a view.

    We have experienced similar issues and in our case the culprit was the (well documented) discrepancy between JSP and JSF life cycles. Have you tried identifying the problematic component with JST Trace?

    BTW, in my experience, dragging components from the palette does not guarantee flawless jsp-code. You should check the resulting code manually (and understand its details).
    I checked manually all ID everything seems ok.
    I never needed to use JST Trace.
    How to start the trace? What should I check?

    paoloc
  • SystemAdmin
    SystemAdmin
    6195 Posts

    Re: "DUPLICATE COMPONENT" ERRORS ARE RECEIVED WHEN USING JSF.

    ‏2013-04-02T19:03:03Z  
    • paoloc
    • ‏2013-04-02T17:41:08Z
    I checked manually all ID everything seems ok.
    I never needed to use JST Trace.
    How to start the trace? What should I check?

    paoloc
    To use JSF tracing open the JSF Trace view. It explains you what you need to to in order to start tracing. I have found tracing an invaluable tool in debugging what happens when a JSF request is processed. (Here it helps if you are familiar with JSF application lifecycle.) In your case, I was hoping that you might be able to trace where the components with duplicate id come from.
  • paoloc
    paoloc
    545 Posts

    Re: "DUPLICATE COMPONENT" ERRORS ARE RECEIVED WHEN USING JSF.

    ‏2013-04-03T10:31:01Z  
    To use JSF tracing open the JSF Trace view. It explains you what you need to to in order to start tracing. I have found tracing an invaluable tool in debugging what happens when a JSF request is processed. (Here it helps if you are familiar with JSF application lifecycle.) In your case, I was hoping that you might be able to trace where the components with duplicate id come from.
    JSF Trace view does not report any error that I understand.
    some lines are marked with green color other with yellow,but they are not the fields in error.
    In "Incomming request:com.sun.faces.context.MyHTTPServeletRequestWrapper@278063d2" I can see an
    com.sun.faces.VIEW=_id4:_id5 that looks like the error log duplicate component form1:id4
    but _id4 does not appear elsewhere (see attachment).
    Can I print this trace?
    I do not know where to look for the error.

    paoloc
  • SystemAdmin
    SystemAdmin
    6195 Posts

    Re: "DUPLICATE COMPONENT" ERRORS ARE RECEIVED WHEN USING JSF.

    ‏2013-04-03T12:52:41Z  
    • paoloc
    • ‏2013-04-03T10:31:01Z
    JSF Trace view does not report any error that I understand.
    some lines are marked with green color other with yellow,but they are not the fields in error.
    In "Incomming request:com.sun.faces.context.MyHTTPServeletRequestWrapper@278063d2" I can see an
    com.sun.faces.VIEW=_id4:_id5 that looks like the error log duplicate component form1:id4
    but _id4 does not appear elsewhere (see attachment).
    Can I print this trace?
    I do not know where to look for the error.

    paoloc
    I cannot say much based on that except that setting ids manually will not help, since the problematic component is com.sun.faces.VIEW.

    A few questions. First, which version of RBD (or RAD) are you using? Your screenshot does not show details about the phases. Secondly, which JSF implementation are you using? As you are running Tomcat 6, you should be using JSF 1.2 implementation.
  • paoloc
    paoloc
    545 Posts

    Re: "DUPLICATE COMPONENT" ERRORS ARE RECEIVED WHEN USING JSF.

    ‏2013-04-03T13:01:32Z  
    I cannot say much based on that except that setting ids manually will not help, since the problematic component is com.sun.faces.VIEW.

    A few questions. First, which version of RBD (or RAD) are you using? Your screenshot does not show details about the phases. Secondly, which JSF implementation are you using? As you are running Tomcat 6, you should be using JSF 1.2 implementation.
    I use RBD 8.5.1 , Toncat 6.35 and JSF 1.2 implementation.
  • paoloc
    paoloc
    545 Posts

    Re: "DUPLICATE COMPONENT" ERRORS ARE RECEIVED WHEN USING JSF.

    ‏2013-04-03T15:33:35Z  
    I cannot say much based on that except that setting ids manually will not help, since the problematic component is com.sun.faces.VIEW.

    A few questions. First, which version of RBD (or RAD) are you using? Your screenshot does not show details about the phases. Secondly, which JSF implementation are you using? As you are running Tomcat 6, you should be using JSF 1.2 implementation.
    How to stop tracing?
  • SystemAdmin
    SystemAdmin
    6195 Posts

    Re: "DUPLICATE COMPONENT" ERRORS ARE RECEIVED WHEN USING JSF.

    ‏2013-04-03T17:39:33Z  
    • paoloc
    • ‏2013-04-03T15:33:35Z
    How to stop tracing?
    You can stop tracing by following the procedure Removing trace support from a JSF application in the manual.