• xe:basicLeafNode

    By Toby Samples 1 decade ago
    Hi,</div>
    
    <br/>
    i am using the Extension Library to build some pages, including using the xe:applicationLayout Control.&nbsp; In that control you can specify the &quot;bannerUtilityLinks&quot;, which I am wanting to do and specify a custom logout method.&nbsp; I am putting a xe:basicLeafNode inside of it and setting the onClick attribute to a method inside of a managed bean.&nbsp; The problem I am running into is that the method is running when the page is loading instead of onclick.&nbsp; Has anyone else seen this when using the xe:basicLeafNode control.&nbsp; Does anyone have any idea how to fix when the event is running?&nbsp; Thanks, I&#39;m rather confused about this one.</div>
    
    &nbsp;</div>
    

    -Toby

    • No,haven't seen that

      By Philippe Riand 1 decade ago

      Can you send a sample?

      • xe:basicLeafNode problem

        By Toby Samples 1 decade ago

        Hi Phillipe, Thanks for responding so quickly.    

        Below is the relevant code from my managed bean and from my xsp markup.  When I run the page, instead of loading and and letting me click logout, it just automatically redirects to home.xsp.  I have an nsf you can see, but I'm not sure where to send it. 

         

        Thanks

        -Toby

         

                      
                           
                       

         

            public void logout() {
               
               
               //Clear Session Map <-- Throws exception, but shouldn't if it is running onClick
               //FacesContext.getCurrentInstance().getExternalContext().getSessionMap().clear();
                try {
                   
                   //redirects to home.xsp
                    XSPContext fctx = XSPContext.getXSPContext(FacesContext.getCurrentInstance());
                    fctx.redirectToPage("home.xsp");
                }
                catch (Exception e) {
                    System.out.println(e);
                }
            }

        • This is the normal behavior

          By Philippe Riand 1 decade ago

          'onclick' is only for attaching client side JavaScript. So the formula you assigned to it is evaluated when the markup is rendered, which explains your behavior. To execute server side script, you have to use an event handler. Unfortunately, you can only assign event handler to controls, and not to complex types like tree nodes. That's the reason why the node has a 'submitValue' property you can set. Then, the server event is handled by the owner control (the application layout in this case). The owner control has access to the submitted value and can execute an action based on it.

          Look at the demo DB, OneUILayout custom control. The place bar shows how to handle actions on the server, by adding a event handler to the app layout control and assigning the 'submitValue' property.

          • Thanks so much!

            By Toby Samples 1 decade ago

            Hi Phillipe,

            Thanks so much for your help!  That did the trick.  Thanks

            -Toby