Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to avoid namespace collision when including identical XHTML JSF 2.0 files
    primarykey
    data
    text
    <p>In my JSF 2.0 project, I get a name-space collision when I include two identical XHTML files in a single parent XHTML file. My goal is to create a dashboard of identical controls on a single page, with each control representing a separate context.</p> <p>For example, in the following JSF file, called <code>parent.xhtml</code> (say), I include two "dashboard" facelets:</p> <pre><code>&lt;ui:define name="body"&gt; &lt;p:panel id="ONE" &gt; &lt;ui:include src="raceboardunit.xhtml"/&gt; &lt;/p:panel&gt; &lt;p:panel id="TWO" &gt; &lt;ui:include src="raceboardunit.xhtml"/&gt; &lt;/p:panel&gt; &lt;/ui:define&gt; </code></pre> <p>To be simple, say the child facelet "raceboardunit.xhtml" is the following:</p> <pre><code>&lt;ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.prime.com.tr/ui"&gt; &lt;p:panel header="Dashboard" &gt; &lt;h:panelGrid columns="2"&gt; &lt;h:outputLabel value="Event" for="idEvent}" /&gt; &lt;h:outputLabel value="#raceBoardController.name}" id="idEvent" /&gt; &lt;/h:panelGrid&gt; &lt;/p:panel&gt; &lt;/ui:composition&gt; </code></pre> <p>The problem is the collision involving the output label <strong>id="idEvent"</strong>, since in the <code>parent.xhtml</code> file, the two inclusions of the child facelet have an identical named component.</p> <p>The error is reported as: <code>Component ID idEvent has already been found in the view.</code></p> <p>The reason for the error is obvious, but <em>what is the best way to include a variable number of identical components in a JSF 2.0 application that maximises code reuse</em>?</p>
    singulars
    1. This table or related slice is empty.
    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.
    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