4 Replies Latest reply on Feb 22, 2010 12:17 PM by Julek K

    Concerning EL in includes

    Julek K Newbie

      Hello everyone!

       

      I came across another issue I'm too inexperienced to be able to resolve.

       

      In my web page there is a main menu built on a single tabPanel and a series of toolBars. I use switchType="ajax". I basically wanted to create some kind of AJAX driven navigation. So I made tabs and links assign a backing bean property holding current subpage address and rerender the area that dynamically includes this subpage. I simplified it to an example that looks like this:

       

      <a4j:form>
           <a4j:commandLink reRender="output" ajaxSingle="true" action="#{backingBean.gotoSomePage}">
                <h:outputTexta value="Some Page">
           </a4j:commandLink>
      </a4j:form>
      
      <a4j:outputPanel id="output">
           <ui:include src="#{backingBean.page}"/>
      </a4j:outputPanel>
      

       

      Now this produces a strange behaviour: the first click won't switch the included page. However the second will. Basically the inclusion mechanism doesn't see the change of the property on time.

       

      I currently use a workaround using static src in includes and this works fine.

       

      I guess this has something to do with the moment the action is fired. Note that putting immediate="true" doesn't change anything.

       

      Question: Is there some way to use EL's in <ui:include> and not get this error? What's the best way of building a "main menu" kind of navigation in RichFaces?

        • 1. Re: Concerning EL in includes
          Nick Belaevski Master

          Hi,

           

          Can you please try a4j:include?

          • 2. Re: Concerning EL in includes
            Julek K Newbie

            Oh, yea, forgot to mention that. I've tried already - it's indifferent.

             

            However I've got some more clues that I've just found out about:

             

            If i put something like this:

             

            <a4j:outputPanel id="output">
                 <h:outputText value="#{backingBean.page}"/>
                 <a4j:include viewId="#{backingBean.page}"/>
            </a4j:outputPanel>
            

             

            than after the first click on the link I get:

             

            /address/of/the/new/page.xhtml
            "An included old page"
            

             

            after the second click I get:

             

            /address/of/the/new/page.xhtml
            "An included new page"
            

             

            Maybe that's of some clue.

             

            Also if I switch backingBean scope to request the second click has the same effect as the first.

             

            Thanks for the reply!

             

            Oh, sorry, another thing: I currently use jboss-el-2.0.1.GA.jar. However I tried with the default ones for JSF 1.2 and encountered the identical problem.

            • 3. Re: Concerning EL in includes
              Ilya Shaikovsky Master

              this

              <h:form>
                   <a4j:include viewId="#{profile.page}" />
                   <a4j:commandButton value="to page 2" reRender="wizard" ajaxSingle="true">
                   <a4j:actionparam name="topage2" value="/richfaces/include/examples/wstep2.xhtml" 
                        assignTo="#{profile.page}"/>
                   </a4j:commandButton>
              </h:form>
              

              Update ("wizard" - id of the panel around the form)

              and

               

              private String page="/richfaces/include/examples/wstep1.xhtml";
                   
                   public String getPage() {
                        return page;
                   }
                   
                   public void setPage(String page) {
                        this.page = page;
                   }
              

              works for me.

               

              seems need you full sample in war for more deep investigation.

              • 4. Re: Concerning EL in includes
                Julek K Newbie

                Oh stupid, stupid me. I finally found the bug. The problem was the option:

                 

                <context-param>
                    <param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
                    <param-value>true</param-value>
                </context-param>
                

                 

                which I left in place after fighting with memory usage. Actually I think this was the root of all evil - so I'll go and post this resolution in the other threads I started.
                I thank you again very much for your help! I really do appreciate.