1 Reply Latest reply on Mar 12, 2010 5:33 PM by Nick Belaevski

    Question about keepAlive

    Rand Asin Novice

      I read about view scope from http://mkblog.exadel.com/jsf/view-scope-in-richfaces/

       

      My problem is it doesn't work with tag.

       

      <!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
      
      <!-- RichFaces tag library declaration -->
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      
      <html>
           <head>
                <title>Page</title>
           </head>
      
           <body>
                <f:view>
                     <a4j:keepAlive beanName="PageBean"></a4j:keepAlive>
                     <h:form>
                          <rich:toolBar binding="#{PageBean.htmlToolBar}"></rich:toolBar>
                          <rich:tabPanel switchType="ajax">
                               <rich:tab label="First">Here is tab #1</rich:tab>
                               <rich:tab label="Second">Here is tab #2</rich:tab>
                               <rich:tab label="Third">Here is tab #3</rich:tab>
                          </rich:tabPanel>
                     </h:form>
                </f:view>
           </body>
      </html>
      

       

      Using the page above, clicking tab #2 causes another PageBean to be created.

       

      However it works if I use KeepAlive annotation on PageBean.  Why doesn't the tag work?  Thanks.