Chris, I think it has to do with the NavigationPane expecting a
commandNavigationItem only as its direct child. It will blow up if it see
something it does not recognize. With ui:repeat, a ui:repeat "component"
gets built into the tree at build time and its children (the
commandNavigationItems) are read a render time. Since NavigationPane does
not recognize the ui:repeat component, it blows up. With c:foreach, it is
evaluated at during the tree building and only the products of its iteration
(the commandNavigationItems) are built into the tree.
I think I have that right.
Thanks again for helping out and the luck.
-Brian
On 1/23/07, Chris Lowe <[EMAIL PROTECTED]> wrote:
Hi Brian,
I'd been able to use ui:repeat in a component without any problems so I'm
not sure what your original problem was related to. However, I'd not been
using the commandNavigationItem either...
Good luck with facelets,
Chris.
On 23/01/07, Brian Smith <[EMAIL PROTECTED]> wrote:
>
> Thanks for the tip Chris,
>
> AddressLookupBacking is the backing bean for an entire page,
> tabOptions is just a List (property) within AddressLookupBacking.
>
> I got it working by using c:forEach instead. It had to with Trinidad
> expecting a commandNavigationItem as the child of navigationPane. With
> ui:repeat, you get a ui:repeat component in the tree with children.
> c:foreach happens at build time so there is no "foreach" component built
> into the tree, just the child components (which trinidad knows how to
> handle). I guess this is one of the cases where c:foreach is preferable
> to
> ui:repeat. I know this could probably be done more elegantly someway
> using
> ui:repeat but I can't see it. Again, this is just one noobs first foray
> into Facelets components.
>
> Thanks again!!
>
> On 1/23/07, Chris Lowe <[EMAIL PROTECTED]> wrote:
> >
> > Try
> >
> > <stl:tabNavigation
> > tabs="#{AddressLookupBacking}"
> > bean="#{AddressLookupBacking}"/>
> >
> > Then refer to the tabOptions in your component as follows:
> >
> > <ui:repeat value="#{tabs['tabOptions']}" var="tab">
> >
> > (of course, if this works you can eliminate 'tabs' altogether and just
> use
> > beans)
> >
> > C.
> >
> >
> > On 23/01/07, Brian Smith <[EMAIL PROTECTED]> wrote:
> > >
> > > I am trying to create a component using Facelet Tags. The component
> > uses
> > > a
> > > Trinidad NavigationPane (tr:NavigationPane). I am trying to make
this
> > > component reusable by passing a collection of "options" to it. Each
> > > option
> > > represents a commandNavigationItem
> > >
> > > Here is the component
> > >
> > > <!--facelets/components/tabNavigation.xhtml-->
> > >
> > > <div
> > > xmlns="http://www.w3.org/1999/xhtml"
> > > xmlns:f="http://java.sun.com/jsf/core"
> > > xmlns:ui="http://java.sun.com/jsf/facelets"
> > > xmlns:tr="http://myfaces.apache.org/trinidad">
> > >
> > > <tr:form>
> > > <tr:panelGroupLayout layout="horizontal">
> > > <tr:navigationPane hint="tabs">
> > > <ui:repeat value="#{tabs}" var="tab">
> > > <tr:commandNavigationItem
> > > text="#{tab.label}"
> > > selected="#{tab.selected}"
> > > partialSubmit="true"/>
> > >
> > > </ui:repeat>
> > > </tr:navigationPane>
> > > </tr:panelGroupLayout>
> > > </tr:form>
> > > </div>
> > >
> > > Here is my usage
> > >
> > > <stl:tabNavigation
> > > tabs="#{AddressLookupBacking.tabOptions}"
> > > bean="#{AddressLookupBacking}"/>
> > >
> > > I am initializing the tabOptions list in Faces-Config
> > >
> > > Here is the tab lib
> > > <facelet-taglib>
> > > <namespace>http://stlouiscity.com/jsf/csb</namespace>
> > > <tag>
> > > <tag-name>tabNavigation</tag-name>
> > > <source>facelets/components/tabNavigation.xhtml</source>
> > > </tag>
> > > </facelet-taglib>
> > >
> > > Here is my problem
> > >
> > > SEVERE: Warning: illegal component hierarchy detected, expected
> > UIXCommand
> > > but found another type of component instead.
> > > java.lang.ClassCastException: com.sun.facelets.component.UIRepeat
> > > at
> > >
> > >
> >
>
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.NavigationPaneRenderer.renderContent
> > > (NavigationPaneRenderer.java:120)
> > > at
> > >
> > >
> >
>
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.NavigationPaneRenderer.encodeAll
> > > (NavigationPaneRenderer.java:83)
> > > at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(
> > > CoreRenderer.java:184)
> > > at
> org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(
> > > UIXComponentBase.java:700)
> > > at org.apache.myfaces.trinidad.component.UIXCollection.encodeEnd
(
> > > UIXCollection.java:495)
> > > at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(
> > > CoreRenderer.java:263)
> > > at
> > >
> > >
> >
>
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelGroupLayoutRenderer.encodeChild
> > > (PanelGroupLayoutRenderer.java:169)
> > > at
> > >
> > >
> >
>
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelGroupLayoutRenderer._encodeChildren
> > > (PanelGroupLayoutRenderer.java:140)
> > > at
> > >
> > >
> >
>
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelGroupLayoutRenderer.encodeAll
> > > (PanelGroupLayoutRenderer.java:92)
> > > at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(
> > > CoreRenderer.java:184)
> > > at
> org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(
> > > UIXComponentBase.java:700)
> > > at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(
> > > ComponentSupport.java:242)
> > > at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(
> > > ComponentSupport.java:239)
> > > at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(
> > > ComponentSupport.java:239)
> > > at com.sun.facelets.FaceletViewHandler.renderView(
> > > FaceletViewHandler.java:580)
> > > at
> > >
> >
>
org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView
> > > (
> > > ViewHandlerImpl.java:178)
> > > at com.sun.faces.lifecycle.RenderResponsePhase.execute(
> > > RenderResponsePhase.java:107)
> > > at com.sun.faces.lifecycle.LifecycleImpl.phase(
LifecycleImpl.java
> > :245)
> > > at com.sun.faces.lifecycle.LifecycleImpl.render(
LifecycleImpl.java
> > > :137)
> > > at javax.faces.webapp.FacesServlet.service(FacesServlet.java
:107)
> > > at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > > ApplicationFilterChain.java:252)
> > > at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > > ApplicationFilterChain.java:173)
> > > at
> > >
> > >
> >
>
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter
> > > (TrinidadFilterImpl.java:327)
> > > at
> > >
> > >
> >
>
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl
> > > (
> > > TrinidadFilterImpl.java:291)
> > > at
> > >
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter
> (
> > > TrinidadFilterImpl.java:214)
> > > at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(
> > > TrinidadFilter.java:93)
> > > at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > > ApplicationFilterChain.java:202)
> > > at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > > ApplicationFilterChain.java:173)
> > > at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(
> > > ReplyHeaderFilter.java:96)
> > > at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > > ApplicationFilterChain.java:202)
> > > at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > > ApplicationFilterChain.java:173)
> > > at org.apache.catalina.core.StandardWrapperValve.invoke(
> > > StandardWrapperValve.java:213)
> > > at org.apache.catalina.core.StandardContextValve.invoke(
> > > StandardContextValve.java:178)
> > > at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke
(
> > > SecurityAssociationValve.java:175)
> > > at org.jboss.web.tomcat.security.JaccContextValve.invoke(
> > > JaccContextValve.java:74)
> > > at org.apache.catalina.core.StandardHostValve.invoke(
> > > StandardHostValve.java:126)
> > > at org.apache.catalina.valves.ErrorReportValve.invoke(
> > > ErrorReportValve.java:105)
> > > at org.apache.catalina.core.StandardEngineValve.invoke(
> > > StandardEngineValve.java:107)
> > > at org.apache.catalina.connector.CoyoteAdapter.service(
> > > CoyoteAdapter.java:148)
> > > at org.apache.coyote.http11.Http11Processor.process(
> > > Http11Processor.java
> > > :869)
> > > at
> > >
> > >
> >
>
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
> > > (Http11BaseProtocol.java:664)
> > > at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
> > > PoolTcpEndpoint.java:527)
> > > at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(
> > > MasterSlaveWorkerThread.java:112)
> > > at java.lang.Thread.run(Thread.java:595)
> > >
> > > It seems that Trinidad is getting hung up on the ui:repeat facelet
> > tag. I
> > > am just learning both Facelets and Trinidad so any help would be
> greatly
> > > appreciated.
> > >
> > > I have posted this both the the Facelets and Trinidad User Lists
> > >
> > >
> >
> >
>
>