3 Replies Latest reply on Feb 19, 2009 8:37 AM by nbelaevski

    Bean executed twice - while calling and exiting the web page

    aish

      Hi,

      I have a .jsp file that displays the backend data table contents using a DataTable tag. When the page containing this is selected, this executes the bean and displays the results. This is fine. But when we exit from that page and go to the next page (that is select a menu to go to the next page), the bean in the first page is getting executed again (during the exit of that page). Not sure why the bean is executed during the exit of the page. Can you please help me understand this.

      Thanks
      Aishu

        • 1. Re: Bean executed twice - while calling and exiting the web
          nbelaevski

          Hello Aishu,

          I guess the bean is executed to process submitted data. There's not enough information to say more.

          • 2. Re: Bean executed twice - while calling and exiting the web

            I have the same question as Aishu. The setter/getter method will executed many times, if it is go to a ui:component or leave it. e.g. A wizard is implemented with modalPanel. Along steps, there is a combbox in the modalPanel, the setter/getter methods of the components h:selectOneMenu and f:selectItems will executed by enter or leave the step. I guess, that the reason is, there are manny ajax component as well as e.g js:function.

            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:rich="http://richfaces.org/rich"
             xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:dim="http://dimetis.de/jsf">
            
             <rich:panel styleClass="backgroundNet" style="height:275px">
             <a4j:outputPanel id="createTaskType">
             <h:panelGrid style="margin-left:60px; margin-top:10px;">
             <h:selectOneMenu style="width : 360px;" immediate="true"
             value="#{createTaskDialogBean.taskType}">
             <f:selectItems value="#{createTaskDialogBean.taskTypes}" />
             <a4j:support event="onchange" ajaxSingle="true"
             oncomplete="item='#{createTaskDialogBean.taskType}';"
             reRender="playoutId"/>
             </h:selectOneMenu>
             <rich:separator height="1px" style="margin-top:7px;"/>
             </h:panelGrid>
             </a4j:outputPanel>
             </rich:panel>
            
             <h:panelGrid columns="3" style="margin-top:8px;vertical-align:bottom">
             <rich:spacer width="190px" />
            
             <a4j:commandButton action="#{createTaskDialogBean.refreshBean}" reRender="createTaskType"
             onclick="Richfaces.hideModalPanel('taskWizard');"
             value="Cancel" style="float:right; width:110px; height:30px;"/>
             <a4j:commandButton value="Next >>" immediate="true"
             style="float:right; width : 110px; height:30px;"
             styleClass="createTaskStep1Object"
            action="#{createTaskDialogBean.getTaskType}"
             onclick="startWait();" oncomplete="stopWait();"/>
             </h:panelGrid>
             <script>
             initCreateTaskStep1Object();
             </script>
            
             <a4j:jsFunction name="closeDlgtaskWizard"
             action="#{createTaskDialogBean.refreshBean}"
             reRender="createTaskType"
             oncomplete="Richfaces.hideModalPanel('taskWizard');" />
            </ui:composition>
            


            • 3. Re: Bean executed twice - while calling and exiting the web
              nbelaevski

              You can use PhaseTracker to check on what lifecycle phases the methods are accessed.