3 Replies Latest reply on Jun 18, 2009 11:21 AM by mohamed bathaoui

    Dynamic actions

    mohamed bathaoui Newbie

      Hi everybody, and sorry because my English isn't very good!
      well, I'm developping a project using JSF, richfaces and Ajax4Richfaces.
      I want to create a page like a header wich will be included in all my pages.

      The probleme I have is that that header contains some a4j:CommandButton wich doing an action...but the action depends on the current page.. each page has here own managed bean.
      Example:
      page a.jsp has the managed Bean aBB.java
      page b.jsp has the managed Bean bBB.java

      for the page a.jsp i have <a4j:CommandButton action="#{aBB.action}">
      for the page b.jsp i have <a4j:CommandButton action="#{bBB.action}">

      There is a way to have a dynamic action?
      I hope you inderstand me!
      Thank you

        • 1. Re: Dynamic actions
          mohamed bathaoui Newbie

          There's no one to help me or i didn't explain the current situation? Thank you

          • 2. Re: Dynamic actions
            Roland Schöler Newbie

            Hi simomyster, don't know if I really understand you problem.
            But I'll try some thinking about.....

            One way could be to dynamically write the page rendering directly in JAVA (but I'vent done this until now....therefore I could not really help you this way...but you can search in forum if you find something?)

            Other way could be to use one single controller bean which set's the action dynamically - meaning something like

            <a4j:CommandButton action="#{myControllerBean.actionForThisPage}">

            => now you must only ensure, that the myControllerBean will got the correct action or actionname in actionForThisPage.....

            Next way: conditional rendering ala rendered="your page condition"

            But this are only suggestions because I've never needed such behaviour.
            By the way you can use facelets too - maybe you can find a solution there?

            regards rschoeler

            • 3. Re: Dynamic actions
              mohamed bathaoui Newbie

              Thank you, but that solutions don't work...
              I can now have a string wich represente the name of the managed Bean responsable of the current view, and the action to do.
              But a4j:CommandButton action = "string" doesent work!!