Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF Conditional includes, cause Component ID has already been found in the view
    primarykey
    data
    text
    <p>I know we can't repeat the ID of any component we have in the same view tree.</p> <p>I have a page which includes another pages by certain condition Like this...</p> <pre><code>&lt;h:panelGroup rendered="#{bean.insertMode == 'SINGLE'}"&gt; &lt;ui:include src="_single.xhtml" /&gt; &lt;/h:panelGroup&gt; &lt;h:panelGroup rendered="#{bean.insertMode == 'DOUBLE'}"&gt; &lt;ui:include src="_double.xhtml" /&gt; &lt;/h:panelGroup&gt; </code></pre> <p> Now In these pages I have "Almost" the same components hierarchy (Complex) with <strong>different</strong> actions behaviour (Not only method calls, also view), for example:</p> <p><em>_single.xhtml</em></p> <pre><code>&lt;p:inputText id="fieldID" value="#{bean.value}" /&gt; &lt;p:commandLink actionListener="#{bean.singleAction()}" /&gt; </code></pre> <p><em>_double.xhtml</em></p> <pre><code>&lt;p:inputText id="fieldID" value="#{bean.value}" /&gt; &lt;p:commandLink actionListener="#{bean.doubleAction()}" /&gt; </code></pre> <p> My little example works fine, and renders as it supposed to, but I get </p> <p><code>java.lang.IllegalStateException: Component ID fieldID has already been found in the view.</code> </p> <p> I know that JSF process the full pages even if they are not included and that's why I'm getting this exception.</p> <p><p> Any smart way to solve this without changing the IDs of the components inside the include pages (Although it works, but the exception is annoying and seems something is wrong). </p> <p>I don't want also to wrap each one of the pages with some container component with a different ID so they would have a different FULL ID like formId:fieldID because the master page is also referring to these components inside these includes! </p></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload