5 Replies Latest reply on Dec 10, 2008 3:31 PM by Nick Belaevski

    keepTransient attribute on a4j:outputPanel not working?

    Sven Meyer Newbie

      I've a question concerning a4j:outputPanel. How does the keepTransient attribut work?

      I thought it would work this way:

      <h:form>
       <a4j:region selfRendered="true">
       <a4j:outputPanel keepTransient="true" id="test">
       <b>text text text</b>
       </a4j:outputPanel>
      
       <a4j:commandLink reRender="test">klick</a4j:commandLink>
       </a4j:region>
      </h:form>
      


      If you press the "klick"-link, the a4j:outputPanel will get rerendered and the "text text text"-text should stay bold because of the keepTransient flag set to true.
      If you set keepTransient to false, the non jsf stuff like text text text is removed on rerender because it is not saved in the component tree.

      But this doesn't work, the bold stuff is removed in both cases after rerender. The docs say

      "Flag for mark all child components to non-transient. If true, all children components will be set to non-transient state and keep in saved components tree. For output in self-renderer region all content ( By default, all content in <f:verbatim> tags and non-jsf elements in facelets, marked as transient - since, self-rendered ajax regions don't plain output for ajax processing )."

      I thought that the good old html b-tags are transient stuff. But they get removed. Why? What i'm missing?



      We use:
      - JBoss 4.2.2 GA
      - JSF Reference Implementation 1.2.09 b2
      - Seam 2.0.2 SP1
      - Richfaces 3.2.2 GA
      - Facelets 1.1.14


        • 1. Re: keepTransient attribute on a4j:outputPanel not working?
          Nick Belaevski Master

          Hi,

          I've created an issue for that: https://jira.jboss.org/jira/browse/RF-4799

          Facelets text is "extra" transient: see the source code for UIComponent instance representing text http://kickjava.com/src/com/sun/facelets/compiler/UILeaf.java.htm
          You can wrap text inside <f:verbatim> tag. Unfortunately that doesn't work with 1.15.B1 Facelets :(

          • 2. Re: keepTransient attribute on a4j:outputPanel not working?
            Sven Meyer Newbie

            Hi,

            thanks for your answer. I've tried your suggestion using f:verbatim with our facelets version 1.1.14 but it doesn't work eighter.

            • 3. Re: keepTransient attribute on a4j:outputPanel not working?
              Nick Belaevski Master

              Strange, that worked for me. Can you please post full page source?

              • 4. Re: keepTransient attribute on a4j:outputPanel not working?
                Sven Meyer Newbie

                OK, you are right, the simple example work if u use f:verbatim, but not our real world application.

                I've created a very simplified use-case to show you how our application works. You can use it to reproduce the bug.

                It consists of 2 pages, one is included in the other with ui:include. The included one is inside a rich:tabpanel which is client-side switched. The included content is rerendered if you click on the tab itself. An a4j:jsFunction is used to do that.

                If you set the selfRendered propperty from the a4j:region to false, the bold text "text text text" shows up between -begin- and -end- after you click on the tab. If you set selfRendered to true, the "text text text" never shows. Thats our problem.

                There are the xhtml files:

                master:

                <!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:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:s="http://jboss.com/products/seam/taglib"
                 xmlns:rich="http://richfaces.org/rich"
                 xmlns:a4j="http://richfaces.org/a4j"
                >
                <ui:composition >
                
                 <h:form>
                 <a4j:region selfRendered="true">
                 <rich:tabPanel switchType="client">
                 <rich:tab
                 label="tab"
                 switchType="client"
                 onlabelclick="LoadContent();"
                 >
                 -begin-
                 <h:panelGroup layout="block" id="ContentContainer">
                 <s:fragment rendered="#{controller.contentLoaded}">
                 <ui:include src="test_inc.xhtml" />
                 </s:fragment>
                 </h:panelGroup>
                 -end-
                
                 <a4j:jsFunction
                 name="LoadContent"
                 reRender="ContentContainer"
                 >
                 <a4j:actionparam
                 assignTo="#{controller.contentLoaded}"
                 value="true"
                 name="loaded"
                 />
                 </a4j:jsFunction>
                 </rich:tab>
                 </rich:tabPanel>
                 </a4j:region>
                 </h:form>
                
                </ui:composition>
                </html>
                


                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:ui="http://java.sun.com/jsf/facelets"
                 xmlns:a4j="http://richfaces.org/a4j"
                >
                <ui:composition>
                 <a4j:outputPanel
                 keepTransient="true"
                 id="test"
                 >
                 <f:verbatim>
                 <b>text text text</b>
                 </f:verbatim>
                 </a4j:outputPanel>
                </ui:composition>
                </html>
                


                • 5. Re: keepTransient attribute on a4j:outputPanel not working?
                  Nick Belaevski Master

                  That happens because panel is not rendered initially.