Hi all,
I've been thinking about what I might be doing that's different from
everyone else.
1) Currently I use a single form for the entire application (my form is
defined at the root only) and my application is in a single large
component tree with many facelet includes so the display is controlled
by <c:if> tags.
2) My form uses prependId="false" - not sure the signficance of setting
this to true.
<h:form id="appform" prependId="false">
3) I don't define any components IDs at all - after all, why should I
define an ID unless I specifically need to refer to that component
again? That would be just pointless busy work.
4) All my common controls I define in separate .xhtml compositions so I
can't give them unique IDs without a duplicate ID (or does the ID get
prepended with the parent component ID?). eg. date.xhtml below
<ui:composition>
<!-- required parameters -->
<!-- property -->
<!-- optional parameters -->
<c:if test="${empty required}">
<c:set var="required" value="false" />
</c:if>
<c:if test="${empty disabled}">
<c:set var="disabled" value="false" />
</c:if>
<c:if test="${empty readOnly}">
<c:set var="readOnly" value="false" />
</c:if>
<c:if test="${not empty label}">
<h:outputText value="${label}" />
</c:if>
<t:inputCalendar monthYearRowClass="yearMonthHeader"
weekRowClass="weekHeader"
currentDayCellClass="currentDayCell"
popupDateFormat="dd/MM/yyyy"
value="#{property['value']}"
renderAsPopup="true"
popupTodayString="Today is :"
popupWeekString="Week"
renderPopupButtonAsImage="true" />
</ui:composition>
5) I'm using a mix of ADF/Facelets/Tomahawk in the MyFaces impl and
given that it happens often but intermittently, perhaps this comment
applies: "Are you using the c:if/c:/choose JSTL tags with facelets? That
was my problem. MyFaces doesn't appreciate my current view changing on
postback to the same view (non-navigation)".
6) Should I be using rendered="#{condition}" instead of the JSTL <c:if
tags to avoid confusing MyFaces? To preserve memory and performance I
actually don't want an include to be compiled at all unless it needs to
be displayed.
Sorry to post to both groups but it could be relevant to both.
Regards, Murray
PS. versions of libs:
10,823 adf-facelets.jar
683,633 adf-faces-api-ea20-SNAPSHOT.jar
3,122,625 adf-faces-impl-ea20-SNAPSHOT.jar
48,742 common-annotations.jar
188,671 commons-beanutils-1.7.0.jar
46,725 commons-codec-1.3.jar
559,366 commons-collections-3.1.jar
168,446 commons-digester-1.6.jar
112,341 commons-el-1.0.jar
31,825 commons-fileupload-1.1.jar
65,621 commons-io-1.2.jar
207,723 commons-lang-2.1.jar
38,015 commons-logging-1.0.4.jar
26,089 el-api.jar
96,983 el-ri.jar
241,801 jsf-facelets1012.jar
50,491 jsp-api.jar
16,923 jstl-1.1.0.jar
252,186 myfaces-api-1.1.3-SNAPSHOT.jar
516,661 myfaces-impl-1.1.3-SNAPSHOT.jar
15,420 portlet.jar
188,993 serializer.jar
1,231,963 tomahawk-1.1.2-SNAPSHOT.jar
3,078,601 xalan.jar
1,203,860 xercesImpl.jar
194,205 xml-apis.jar
12,398,732 bytes
-----Original Message-----
From: Murray Brandon [mailto:[EMAIL PROTECTED]
Sent: Monday, March 27, 2006 12:08 PM
To: [EMAIL PROTECTED]
Subject: Duplicate id : _id1. Child could not be added.
The following xhtml fails when I include it using ui:include.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jstl/core"
>
<ui:composition>
<h:outputText value="Well well well" />
<h:commandButton id="b" type="submit" action="success"
value="Submit" />
</ui:composition>
</html>
This fails, however if I change the outputText to read
<h:outputText id="a" value="Well well well" />
it works fine.
I'm including using a <c:if snippet in another file/component.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jstl/core"
>
:
<ui:component>
:
:
<h:panelGrid id="pagePanels" width="100%">
<c:if test="#{ui.tabPanel.selection == 'user'}">
<ui:include src="file:userSearchPanel.xhtml" />
</c:if>
<c:if test="#{ui.tabPanel.selection == 'rules'}">
<ui:include src="file:panel1.xhtml" />
</c:if>
<c:if test="#{ui.tabPanel.selection == 'role'}">
<ui:include src="file:panel2.xhtml" />
</c:if>
<c:if test="#{ui.tabPanel.selection == 'resources'}">
<ui:include src="file:controlTest.xhtml" />
</c:if>
<c:if test="#{ui.tabPanel.selection == 'system'}">
<ui:include src="file:examples2.xhtml" />
</c:if>
</h:panelGrid>
I'd rather not have to define unique ID's for each of my compositions as
I'll be re-using them a lot. Anyone got ideas what I've done wrong?
Regards, Murray