Topic
10 replies Latest Post - ‏2013-04-03T17:39:33Z by SystemAdmin
paoloc
paoloc
508 Posts
ACCEPTED ANSWER

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
    936 Posts
    ACCEPTED ANSWER

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

    ‏2013-03-27T16:36:04Z  in response to paoloc
    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
      508 Posts
      ACCEPTED ANSWER

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

      ‏2013-03-30T07:14:53Z  in response to dan_darnell
      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
        ACCEPTED ANSWER

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

        ‏2013-04-02T07:31:27Z  in response to 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
          508 Posts
          ACCEPTED ANSWER

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

          ‏2013-04-02T17:41:08Z  in response to SystemAdmin
          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
            ACCEPTED ANSWER

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

            ‏2013-04-02T19:03:03Z  in response to 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
              508 Posts
              ACCEPTED ANSWER

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

              ‏2013-04-03T10:31:01Z  in response to SystemAdmin
              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
                ACCEPTED ANSWER

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

                ‏2013-04-03T12:52:41Z  in response to 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.