7 Replies Latest reply on Jan 21, 2010 1:54 AM by radu radu

    a4j:actionparam question

    radu radu Novice

      Hi ,

       

      I am using an a4j:actionparam trying to set a value which comes from a bean in a modal panel when user click on an menu item.

       

      This is a part of my code:

      ...
      <rich:menuItem  ajaxSingle="true" oncomplete="#{rich:component('myModalPanel')}.show()" reRender="myModalPanel"  submitMode="ajax">
            <a4j:actionparam name="param" value="#{bean1.value1}" />
      </rich:menuItem>

       

      ....

       

      <rich:modalPanel id="myModalPanel">

      ...

         <h:outputText id="testParam" value="#{param}" />

      ...

      </rich:modalPanel>

       

      What i am trying to do is to implement this behavior without using a second bean where to set the value of a4j:actionparam, something like:

              <a4j:actionparam name="param" value="#{bean1.value1}"  assignTo="#{bean2.value2}" />

       

      Please if you have an idea about this, give me a hand...

       

      Regards,

      Radu

        • 1. Re: a4j:actionparam question
          Ilya Shaikovsky Master
          This parameter is placed in request map. So it's already cleared when render responce phase executed. So you have to store it in some object.
          1 of 1 people found this helpful
          • 2. Re: a4j:actionparam question
            marian furdui Newbie

            Maybe this could help you

             

            (add a:support to the element you want to click):

             

            <a:support event="onclick" reRender="testParam">
                 <f:setPropertyActionListener value="#{bean1.value1}" target="#{bean2.value2}" />
            </a:support>
            
            <h:outputText id="testParam" value="#{bean2.value2}" />
            
            1 of 1 people found this helpful
            • 3. Re: a4j:actionparam question
              Ilya Shaikovsky Master
                      <a4j:actionparam name="param" value="#{bean1.value1}"  assignTo="#{bean2.value2}" />
              this will do the same.
              • 4. Re: a4j:actionparam question
                radu radu Novice

                Hi ,

                 

                Thanks very much for posting and helping !

                 

                I found this article

                  http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=editDataTable

                 

                there it is used an aj4:actionparam something like  <a4j:actionparam name="vin" value="{carVin}" /> where i belive that "vin" is used like an index for an iterator... and is called something like:

                 

                <rich:dataTable value="#{dataTableScrollerBean.allCars}"   onRowContextMenu="#{rich:component('menu')}.show(event,{carVin:'#{category.vin}')}">

                     <rich:column width="200px">
                            <f:facet name="header">
                                <h:outputText value="VIN" />
                            </f:facet>
                            <h:outputText value="#{category.vin}" />
                     </rich:column>

                 

                Any way i tryed to do it in that way but also without a second bean it does not work... but after i found this example i am confuzed, is there a way to send,store the value from that <a4j:actionparam without to store it in a bean (using assignTo property) ?

                 

                Regards,

                Radu

                • 5. Re: a4j:actionparam question
                  radu radu Novice

                  Hi ,

                   

                  Thanks very much for posting and helping !

                   

                  I found this article

                    http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=editDataTable

                   

                  there it is used an aj4:actionparam something like  <a4j:actionparam name="vin" value="{carVin}" /> where i belive that "vin" is used like an index for an iterator... and is called something like:

                   

                  <rich:dataTable value="#{dataTableScrollerBean.allCars}"   onRowContextMenu="#{rich:component('menu')}.show(event,{carVin:'#{category.vin}')}">

                       <rich:column width="200px">
                              <f:facet name="header">
                                  <h:outputText value="VIN" />
                              </f:facet>
                              <h:outputText value="#{category.vin}" />
                       </rich:column>

                   

                  Any way i tryed to do it in that way but also without a second bean it does not work... but after i found this example i am confuzed, is there a way to send,store the value from that <a4j:actionparam without to store it in a bean (using assignTo property) ?

                   

                  Regards,

                  Radu

                  • 6. Re: a4j:actionparam question
                    Ilya Shaikovsky Master
                    when the param used without assignTo - it should be handled like standard f:param -you should process it in action or listener by getting from request parameters map
                    • 7. Re: a4j:actionparam question
                      radu radu Novice

                      Hi !

                       

                        Thanks a lot for your post, it was very helpful !

                       

                      Regards,

                      Radu