I have one probelem with using rendered (pls see the short thread "Rendering with jstl vs 'rendered'-attribute").

When rendering (large) tables with conditional command-links, the command-link-action cannot be called if the the table/view cannot be re-created in the RESTORE_VIEW phase. This means that I need to to save the data until the RESTORE-VIEW phase somehow. Using a 'static' jstl pages solves this problem - but it doesn't feel all that JSF-ish.

/Magnus

Many of the new markups have been opting for a more declarative approach (lack of if/choose/when/etc). My recommendation is to simply use the rendered property as much as you can instead of adding lots of imperative logic. I think it makes for a cleaner UI anyways. As for efficiency, many of the UIComponents will stop evaluation on themselves and their children if the rendered attribute is false.

Overall, the declarative approach to JSF may be the key to *really* improving state saving.

-- Jacob

Andrew Robinson wrote:

SOLVED! Posting this here for others that get the same error.

Jacob solved my whole 1.1.1 & duplicate ID problem. The culprit is the
JSTL tag support in facelets combined with ID generation in MyFaces.
The c:if or c:choose/c:when/c:otherwise are causing components to be
added & subtracted into my view. Simply removing these tags and using
rendered="#{condition}" and rendered="#{!condition}" on my components
works, even with 1.1.1 (no nightlies needed).

Thanks Jacob!

-Andrew

On 3/6/06, Andrew Robinson <[EMAIL PROTECTED]> wrote:
No I haven't. I did get the error to go away when I stopped using id
attributes against the nightlies. I am about to test this against
1.1.1. That would probably fix it though, as the errors seem to always
occur when I use c:if or c:choose.

On 3/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Did you try throwing out the use of c:choose and instead move your test EL to the 'rendered' attribute of the image components themselves?



Use case:
Facelets being included in a page.
The children of the component have their renderer flag set based on a
backing bean state.
Image buttons (commandLink with graphicImage under it) are changed
based on the current state using c:choose/c:when/c:otherwise.
Using AjaxAnywhere to post back to the same page again and again
without any navigation (always staying on the same view).

English description:
I have a bar with severl collapsable panels. There are show/hide
buttons on each panel. If the panel is shown, I create a collapse
button and then render a t:div tag. If the panel is hidden, I create a
expand button with the renderer property of the t:div tag set to
false.

Error:
java.lang.IllegalStateException: Client-id :
actionPaneSubPanelImgExpand is duplicated in the faces tree. Component
: actionPaneForm:actionPaneSubPanelImgExpand, path: {Component-Path :
[Class: javax.faces.component.UIViewRoot,ViewId:
/pages/ContentMgmt/landing.xhtml][Class:
org.ajaxanywhere.jsf.ZoneUIComponent,Id: actionPaneZone][Class:
javax.faces.component.html.HtmlForm,Id: actionPaneForm][Class:
org.apache.myfaces.custom.div.Div,Id: actionPanePanelBody][Class:
org.apache.myfaces.component.html.ext.HtmlCommandLink,Id:
actionPaneSubPanelLink_1][Class:
org.apache.myfaces.component.html.ext.HtmlGraphicImage,Id:
actionPaneSubPanelImgExpand]}
      at
org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(Jsp
StateManagerImpl.java:309)
      at
org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(Jsp
StateManagerImpl.java:324)
      at
org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(Jsp
StateManagerImpl.java:324)
      at
org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(Jsp
StateManagerImpl.java:320)
      at
org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(Jsp
StateManagerImpl.java:324)
      at
org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(Jsp
StateManagerImpl.java:324)
      at
org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedView(JspSt
ateManagerImpl.java:276)
      at
org.jboss.seam.jsf.SeamPhaseListener$StateManagerInterceptor.saveSerializedView
(SeamPhaseListener.java:210)
      at
com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:471)
      at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:252)
      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:173)
      at org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:57)
      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:202)
      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:173)
      at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:
81)
      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.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.CustomPrincipalValve.invoke(CustomPrincipalValve.
java:39)
      at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociati
onValve.java:159)
      at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.ja
va:482)
      at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)

      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:10
7)
      at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnecti
on(Http11Protocol.java:744)
      at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:5
27)
      at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.
java:112)
      at java.lang.Thread.run(Thread.java:595)


This is on facelets 1.0.12. Myfaces SVN information:

svn info
Path: .
URL: http://svn.apache.org/repos/asf/myfaces/current
Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
Revision: 380764
Node Kind: directory
Schedule: normal
Last Changed Author: weber
Last Changed Rev: 378788
Last Changed Date: 2006-02-18 14:53:55 -0700 (Sat, 18 Feb 2006)
Properties Last Updated: 2006-02-21 23:14:29 -0700 (Tue, 21 Feb 2006)

Structure of my code:
firstPage.xhtml
include "actionPane.xhtml"
  includes "actionPanePanel.xhtml" several times
    includes "actionPaneSubPanel.xhtml" 1 or more times

relavant content in mycollapseablepane.xhtml:
<t:commandLink actionListener="#{actionPane.toggleCollapsed}"
            id="actionPaneSubPanelLink">
            <f:param name="collapseKey" value="#{id}"
              id="actionPaneSubPanelLinkParam" />
            <c:choose>
              <c:when test="#{!actionPane.collapsedState[id]}">
                <t:graphicImage id="actionPaneSubPanelImgCollapse"
                  url="#{msg['actionpane.sub.collapse.url']}" />
              </c:when>
              <c:otherwise>
                <t:graphicImage id="actionPaneSubPanelImgExpand"
                  url="#{msg['actionpane.sub.expand.url']}" />
              </c:otherwise>
            </c:choose>
          </t:commandLink>
        </div>
        <div class="expandSubPanelText">#{title}</div>
      </div>
      <t:div rendered="#{!actionPane.collapsedState[id]}"
id="actionPaneSubPanelBody"
        styleClass="actionPaneSubPanelBody">
        <ui:insert />
      </t:div>

Problem occurs when I post back to the server the second time I expand
or collapse panels.

So initial state:
ActionPane
Expanded parent
  Expanded child 1
  Expanded child 2

Still working when I collapse a child:
ActionPane
Expanded parent
  Collpased child 1
  Expanded child 2

This breaks:
ActionPane
Expanded parent
  Collpased child 1
  Collpased child 2 (Error here, the IDs for the 2nd included child
are reproduced)

Here is the ID information from the HTML:
Image 1 (on child 1) ID is: actionPaneForm:actionPaneSubPanelImgCollapse Image 2 (on child 2) ID is: actionPaneForm:actionPaneSubPanelImgCollapse_1

After I collapse child 1:
Image 1 (on child 1) ID is: actionPaneForm:actionPaneSubPanelImgExpand
Image 2 (on child 2) ID is: actionPaneForm:actionPaneSubPanelImgCollapse

When I attempt to close child 2 I get the error of:
actionPaneSubPanelImgExpand is duplicated in the faces tree

Therefore, for some reason, actionPaneForm:actionPaneSubPanelImgExpand
is getting used instead of
actionPaneForm:actionPaneSubPanelImgExpand_1

So looks like even with the myfaces nightlies the bug is still around.

Basically I'm dead in the water with MyFaces. Any help appreciated. I
may have to stop using facelets include functionality as my way of
building these guys and go to UI components, but that would obviously
add a lot of time to my project as there is a lot of code in my
facelet include files.

-Andrew

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





Reply via email to