8 Replies Latest reply on May 12, 2007 4:32 AM by terron

    a4j:support within a a4j:include (Facelets)

    terron

      Hello,

      I have a a4j:support in a h:selectOneMenu which should update another
      h:selectOneMenu calling a method from a managed-bean manBean.
      This is all located within a, with a4j:include, included page.

      The whole functionality was working before I extracted that part from the main page (parent) to the included page (child). So, without having any a4j:include.

      I read in the doc that you have to reRender the "parent" tag, which in this case is a h:panelGroup:
      ___________Parent Page________________________________
      <h:panelGroup id="theSubpage">
      <a4j:include id="incSub" viewId="../include/SubPage1.xhtml" />
      </h:panelGroup>
      _____________________________________________________

      And I do it this way:

      ___________Child Page________________________________
      <h:panelGroup>
      <h:selectOneMenu id="sel1" rendered="true" value="#manBean.prop1}" styleClass="sc1">
      <f:selectItems value="#{manBean.props1}"/>
      <a4j:support event="onchange" action="#{manBean.action1}" reRender="panelGroup2,theSubpage" />
      </h:selectOneMenu>
      </h:panelGroup>
      _____________________________________________________

      I also reRender panelGroup2, because that contains the selectOneMenu to change.

      Somehow the manBean.action1 is not being called. I see the ajax call coming to the server, but the method is not being call and also no
      error/exception is generated
      ... not even a warning...

      I tried using <a4j:keepAlive beanName="manBean"/> but didn't hep either.

      It all works if I have it in the parent page, but not if I extract it in the child page.

      Any Ideas?
      Thanks!

        • 1. Re: a4j:support within a a4j:include (Facelets)

          you do not have to point to parent component anymore. I was required only for ajax4jsf 1.0.6 (and below) and only if you use a4j:include for navigation. It does not look like your case.

          if you need to use one selectOneMenu to update another, surround the first one with a4j:region


          • 2. Re: a4j:support within a a4j:include (Facelets)
            terron

            Hello Sergey + thanks for your answer.

            The question is then why was it working when it was all in one page?

            However, you solution is then to use a4j:region.
            And I have to surround the "master" selectOneMenu ? So, the one firing the changes.

            not the "slave" selectOneMenu (the one being changed by ajax)?

            Thnx!

            • 3. Re: a4j:support within a a4j:include (Facelets)

              the difference between the stuff included with a4j:include and directly located on the page is a prefix of each including id as soon as a4j:include is a naming container from the jsf p+oint of view. ( I do not see why it might be important in your case)

              Recommendation to limit the processing for only the master selectOneMenu is also a general recommendation

              • 4. Re: a4j:support within a a4j:include (Facelets)
                terron

                a4j:region is also not helping....


                Why is the method action1 from the a4j:support action, not being called ??!! (action="#{manBean.action1}")


                the event="onchange" is firing an ajax request but the method is not being called...

                • 5. Re: a4j:support within a a4j:include (Facelets)
                  ilya_shaikovsky

                  have you used

                  <a4j:outputPanel ajaxRendered="true">
                  <h:messages/>
                  </a4j:outputPanel>
                  

                  inside your form?

                  Colud you please post somewhere your sources to make us shure that we talk about one things..

                  Thanks.

                  • 6. Re: a4j:support within a a4j:include (Facelets)
                    terron

                    yes, I used

                    <a4j:outputPanel ajaxRendered="true">
                    <h:messages/>
                    </a4j:outputPanel>

                    but this is not giving any messages...

                    After trying (more) different things, I used Firefox2. That browser does it! The code is working there as wanted!

                    My problem is that I have to make it for IE6...
                    I compared the two logs (one with FF2 and one with IE6) and they are pretty different.
                    However I have no clue what the issue can be. Maybe you do?
                    I pasted below the log produced after the event="onchange" fired in the a4j:support within the a4j:include.

                    FF2_______________

                    17:48:46,265 DEBUG BaseFilter:200 - Filter start request processing at 09/05/07 17:48 for uri: /MyApp/faces/pgs/assigns/ParentPage.xhtml
                    17:48:46,265 DEBUG BaseFilter:170 - Incoming request has Content-Type header with character encoding UTF-8
                    17:48:46,265 DEBUG BaseFilter:216 - Filter request output to XML
                    17:48:46,265 DEBUG AjaxPhaseListener:119 - Process before phase RESTORE_VIEW 1
                    17:48:46,281 DEBUG UIAjaxSupport:140 - Called setParent for AjaxSupport component with parent : javax.faces.component.html.HtmlInputText
                    17:48:46,281 DEBUG UIAjaxSupport:149 - Detect newly created component
                    17:48:46,281 DEBUG UIAjaxSupport:140 - Called setParent for AjaxSupport component with parent : javax.faces.component.html.HtmlInputText
                    17:48:46,281 DEBUG UIAjaxSupport:149 - Detect newly created component
                    17:48:46,281 DEBUG UIAjaxSupport:140 - Called setParent for AjaxSupport component with parent : javax.faces.component.html.HtmlSelectOneMenu
                    17:48:46,281 DEBUG UIAjaxSupport:149 - Detect newly created component
                    17:48:46,281 DEBUG UIAjaxSupport:140 - Called setParent for AjaxSupport component with parent : javax.faces.component.html.HtmlInputText
                    17:48:46,281 DEBUG UIAjaxSupport:149 - Detect newly created component
                    17:48:46,281 DEBUG AjaxRegionBrige:265 - Restore State of UIAjaxComponent with Id _viewRoot
                    17:48:46,281 DEBUG AjaxRegionBrige:265 - Restore State of UIAjaxComponent with Id j_id33
                    17:48:46,281 DEBUG AjaxPhaseListener:72 - Process after phase RESTORE_VIEW 1
                    17:48:46,296 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,296 DEBUG AjaxPhaseListener:119 - Process before phase APPLY_REQUEST_VALUES 2
                    17:48:46,296 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,296 DEBUG RendererBase:71 - Start decoding of component parentForm:incSub:childForm:j_id35 with class org.ajax4jsf.ajax.html.HtmlAjaxSupport
                    17:48:46,296 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,296 DEBUG RendererBase:71 - Start decoding of component parentForm:incSub:childForm:j_id33 with class org.ajax4jsf.ajax.html.HtmlAjaxRegion
                    17:48:46,296 DEBUG AjaxContainerRenderer:152 - Decode ajax request status for parentForm:incSub:childForm:j_id33
                    17:48:46,296 DEBUG AjaxContainerRenderer:154 - Request parameters map {AJAXREQUEST=parentForm:incSub:childForm:j_id33, parentForm:incSub:childForm:su1as1=Laptop, javax.faces.ViewState=j_id50:j_id52, parentForm:incSub:childForm=parentForm:incSub:childForm, parentForm:incSub:childForm:j_id35=parentForm:incSub:childForm:j_id35}
                    17:48:46,296 DEBUG AjaxRegionBrige:195 - Submitted AJAX request - Queue Event to AjaxListeners
                    17:48:46,296 DEBUG AjaxPhaseListener:72 - Process after phase APPLY_REQUEST_VALUES 2
                    17:48:46,296 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,296 DEBUG AjaxPhaseListener:119 - Process before phase PROCESS_VALIDATIONS 3
                    17:48:46,296 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,312 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'manBean' in via original VariableResolver
                    17:48:46,312 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'manBean' in via original VariableResolver
                    17:48:46,312 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'manBean' in via original VariableResolver
                    17:48:46,312 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,312 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,312 DEBUG AjaxPhaseListener:72 - Process after phase PROCESS_VALIDATIONS 3
                    17:48:46,312 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,312 DEBUG AjaxPhaseListener:119 - Process before phase UPDATE_MODEL_VALUES 4
                    17:48:46,312 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,328 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'manBean' in via original VariableResolver
                    17:48:46,328 DEBUG AjaxPhaseListener:72 - Process after phase UPDATE_MODEL_VALUES 4
                    17:48:46,328 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,328 DEBUG AjaxPhaseListener:119 - Process before phase INVOKE_APPLICATION 5
                    17:48:46,328 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,328 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'manBean' in via original VariableResolver
                    ******************
                    The method is being called here
                    ******************

                    17:48:46,328 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,328 DEBUG AjaxPhaseListener:72 - Process after phase INVOKE_APPLICATION 5
                    17:48:46,328 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,328 DEBUG AjaxPhaseListener:119 - Process before phase RENDER_RESPONSE 6
                    17:48:46,328 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,328 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,328 DEBUG AjaxPhaseListener:127 - PhaseListener enter Before RenderView Phase with ViewId /pgs/assigns/ParentPage.xhtml and RenderKitId HTML_BASIC
                    17:48:46,328 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,328 DEBUG AjaxViewHandler:268 - Process AJAX events to calculate areas.
                    17:48:46,328 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,328 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,328 DEBUG AjaxContext:676 - Invoke AjaxRegion Listener for component with Id=j_id35
                    17:48:46,328 DEBUG AjaxRendererUtils:612 - Calculate absolute ID for component Option2 as :parentForm:incSub:childForm:Option2
                    17:48:46,343 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,343 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,343 DEBUG AjaxRegionBrige:228 - Send Event to AjaxListeners from AjaxContainer with Id j_id33
                    17:48:46,343 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,343 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,343 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,343 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:48:46,343 DEBUG UIAjaxSupport:140 - Called setParent for AjaxSupport component with parent : javax.faces.component.html.HtmlInputText
                    17:48:46,343 DEBUG UIAjaxSupport:149 - Detect newly created component
                    17:48:46,343 DEBUG UIAjaxSupport:218 - Set ValueBinding for onkeyup event property
                    17:48:46,343 DEBUG UIAjaxSupport:96 - Create JavaScript event string for component j_id11
                    17:48:46,343 DEBUG UIAjaxSupport:140 - Called setParent for AjaxSupport component with parent : javax.faces.component.html.HtmlInputText
                    17:48:46,343 DEBUG UIAjaxSupport:149 - Detect newly created component ...
                    ...


                    IE6_______________

                    17:40:48,875 DEBUG BaseFilter:200 - Filter start request processing at 09/05/07 17:40 for uri: /MyApp/faces/pgs/assigns/ParentPage.xhtml
                    17:40:48,875 DEBUG BaseFilter:170 - Incoming request has Content-Type header with character encoding UTF-8
                    17:40:48,875 DEBUG BaseFilter:216 - Filter request output to XML
                    17:40:48,875 DEBUG AjaxPhaseListener:119 - Process before phase RESTORE_VIEW 1
                    17:40:48,875 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,875 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,875 DEBUG AjaxPhaseListener:72 - Process after phase RESTORE_VIEW 1
                    17:40:48,875 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,875 DEBUG AjaxPhaseListener:119 - Process before phase RENDER_RESPONSE 6
                    17:40:48,875 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,875 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,875 DEBUG AjaxPhaseListener:127 - PhaseListener enter Before RenderView Phase with ViewId /pgs/assigns/ParentPage.xhtml and RenderKitId HTML_BASIC
                    17:40:48,875 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,875 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,875 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,875 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,875 DEBUG UIAjaxSupport:140 - Called setParent for AjaxSupport component with parent : javax.faces.component.html.HtmlInputText
                    17:40:48,890 DEBUG UIAjaxSupport:149 - Detect newly created component
                    17:40:48,890 DEBUG UIAjaxSupport:218 - Set ValueBinding for onkeyup event property
                    17:40:48,890 DEBUG UIAjaxSupport:96 - Create JavaScript event string for component j_id11
                    17:40:48,890 DEBUG UIAjaxSupport:140 - Called setParent for AjaxSupport component with parent : javax.faces.component.html.HtmlInputText
                    17:40:48,890 DEBUG UIAjaxSupport:149 - Detect newly created component
                    17:40:48,890 DEBUG UIAjaxSupport:218 - Set ValueBinding for onkeyup event property
                    17:40:48,890 DEBUG UIAjaxSupport:96 - Create JavaScript event string for component j_id26
                    17:40:48,890 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'manBean' in via original VariableResolver
                    17:40:48,890 DEBUG UIAjaxSupport:140 - Called setParent for AjaxSupport component with parent : javax.faces.component.html.HtmlSelectOneMenu
                    17:40:48,890 DEBUG UIAjaxSupport:149 - Detect newly created component
                    17:40:48,890 DEBUG UIAjaxSupport:218 - Set ValueBinding for onchange event property
                    17:40:48,890 DEBUG UIAjaxSupport:96 - Create JavaScript event string for component j_id35
                    17:40:48,906 DEBUG UIAjaxSupport:140 - Called setParent for AjaxSupport component with parent : javax.faces.component.html.HtmlInputText
                    17:40:48,906 DEBUG UIAjaxSupport:149 - Detect newly created component
                    17:40:48,906 DEBUG UIAjaxSupport:218 - Set ValueBinding for onkeyup event property
                    17:40:48,906 DEBUG UIAjaxSupport:96 - Create JavaScript event string for component j_id49
                    17:40:48,906 DEBUG FilterServletResponseWrapper:226 - Create StringWriter for buffer servlet output
                    17:40:48,906 DEBUG RendererBase:92 - Start encoding of component _viewRoot with class org.ajax4jsf.framework.ajax.AjaxViewRoot
                    17:40:48,906 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,906 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,906 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'manBean' in via original VariableResolver
                    17:40:48,906 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,906 DEBUG AjaxRendererUtils:181 - Build onclick string for component j_id11 as A4J.AJAX.Submit('_viewRoot','parentForm',event,{'parameters':{'parentForm:j_id11':'parentForm:j_id11'},'actionUrl':'/MyApp/faces/pgs/assigns/ParentPage.xhtml','control':this,'single':true})
                    17:40:48,906 DEBUG RendererBase:92 - Start encoding of component parentForm:j_id12 with class org.richfaces.component.html.HtmlSuggestionBox
                    17:40:48,906 DEBUG RootElement:61 - Encode compiled template "org/richfaces/renderkit/html/templates/popup.jspx"
                    17:40:48,921 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'ajaxContext' in via original VariableResolver
                    17:40:48,921 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'manBean' in via original VariableResolver
                    ~~~~~~~~~~~~~~~~~~getter of a not related field called here~~~~~~~~~~~~~~~~~~~~
                    17:40:48,921 DEBUG InternetResourceBuilder:316 - Build URI for Resource with key [org/richfaces/renderkit/html/images/spacer.gif] as : /MyApp/faces/a4j.res/org/richfaces/renderkit/html/images/spacer.gif
                    17:40:48,921 DEBUG RendererBase:117 - Finish encoding of component parentForm:j_id12 with class org.richfaces.component.html.HtmlSuggestionBox
                    17:40:48,921 DEBUG DelegatingVariableResolver:106 - Attempting to resolve variable 'manBean' in via original VariableResolver
                    17:40:48,921 DEBUG EmployeeDAOHbnt:65 - finding all Employee instances
                    17:40:48,921 DEBUG SessionFactoryUtils:329 - Opening Hibernate Session
                    17:40:48,921 DEBUG DriverManagerDataSource:289 - Creating new JDBC Connection to ...
                    ...


                    • 7. Re: a4j:support within a a4j:include (Facelets)
                      terron


                      Do you see in the FF2 log that "the method" is being call. That does not happen in the IE6 log.

                      Any idea welcome.
                      thnx

                      • 8. Re: a4j:support within a a4j:include (Facelets)
                        terron

                        I had to give up that idea (something similar to the wizard-demo) of
                        having a progressing small window within a master one,
                        and complete submit the whole page.

                        Is a shame though. It gave it a real rich feeling, but the Ajax functionalities
                        within that small window were not working in IE6 (and that is unfortunately our standard).

                        I have the feeling that that has to do with security configurations... redirection
                        of requests... IE6 is blocking something there. It is a shame that no clear log
                        is being generated (see in this thread earlier posts).