12 Replies Latest reply on Jun 5, 2007 12:05 PM by Sergey Halipov

    tabPanel - tabs - a4jcommandlink - actionparam

    moldovan Newbie

      Hy!

      I have noticed, that a4j:actionparam ist only working in first Tab of TabPanel.

      I had tried (SampleCode):

      <rich:tabPanel switchType="ajax">
       <rich:tab label="1. TAB" >
       <h:outputText value="it works --> " />
       <a4j:commandLink id="tabcommandlink1" value="printout" action="#{bean.action}" >
       <a4j:actionparam value="ThisIsTestParam1" assignTo="#{bean.variable}" />
       </a4j:commandLink>
       </rich:tab>
       <rich:tab label="2. TAB">
       <h:outputText value="it does not work --> " />
       <a4j:commandLink id="tabcommandlink2" value="printout" action="#{bean.action}" >
       <a4j:actionparam value="ThisIsTestParam2" assignTo="#{bean.variable}" />
       </a4j:commandLink>
       </rich:tab>
      </rich:tabPanel>
      


      Only when the action in the first tab is getting called, the setter of the Variable get called.
      When activating the 2nd tab and clicking the commandlink, a4j:actionparam-tag is not working!

      Please check it, if I'm right!

        • 1. Re: tabPanel - tabs - a4jcommandlink - actionparam
          moldovan Newbie

          Has anybody of you noticed this behaviour??

          For me, I'm getting in troubles, because my webapp has many tabs, and i cannot assign parameters, which are needed an action-methods.

          • 2. Re: tabPanel - tabs - a4jcommandlink - actionparam
            Ilya Shaikovsky Master

            Unable to reproduce on the RC1.

            • 3. Re: tabPanel - tabs - a4jcommandlink - actionparam
              moldovan Newbie

              Ok, ilya!

              I will upgrade to RC2 and check it again. Maybe I'm using an to old 3.0.1 snapshot - version.

              • 4. Re: tabPanel - tabs - a4jcommandlink - actionparam
                Ilya Shaikovsky Master

                Ok.. Just inform us if it will be unsuccessfull.

                • 5. Re: tabPanel - tabs - a4jcommandlink - actionparam
                  moldovan Newbie

                  Tested it with RC2, but getting the same behaviour.

                  Take this testsite:

                  <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
                  <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
                  <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                  <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
                  <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
                  
                  <html>
                   <head>
                   <title>AJAX - WebApplication</title>
                   </head>
                   <body>
                   <f:view>
                   <a4j:region id="region">
                   <a4j:outputPanel id="outputpanel">
                   <a4j:form id="siteform">
                   <a4j:outputPanel ajaxRendered="true">
                   <h:messages showDetail="false" showSummary="true" />
                   </a4j:outputPanel>
                  
                   <rich:tabPanel switchType="ajax">
                   <rich:tab label="1. TAB" >
                   <h:outputText value="Here is commandLink No 1: " />
                   <a4j:commandLink id="commandlink1" value="just click" action="#{testTabPanel.actionMethod1}" reRender="outputpanel" >
                   <a4j:actionparam value="TestParam1" assignTo="#{testTabPanel.var1}" />
                   </a4j:commandLink>
                   </rich:tab>
                   <rich:tab label="2. TAB">
                   <h:outputText value="Here is commandLink No 2: " />
                   <a4j:commandLink id="commandlink2" value="just click" action="#{testTabPanel.actionMethod2}" reRender="outputpanel" >
                   <a4j:actionparam value="TestParam2" assignTo="#{testTabPanel.var2}" />
                   </a4j:commandLink>
                   </rich:tab>
                   <rich:tab label="3. TAB">
                   <h:outputText value="Here is commandLink No 3: " />
                   <a4j:commandLink id="commandlink3" value="just click" action="#{testTabPanel.actionMethod3}" reRender="outputpanel" >
                   <a4j:actionparam value="TestParam3" assignTo="#{testTabPanel.var3}" />
                   </a4j:commandLink>
                   </rich:tab>
                   <rich:tab label="4. TAB">
                   <h:outputText value="Here is commandLink No 4: " />
                   <a4j:commandLink id="commandlink4" value="just click" action="#{testTabPanel.actionMethod4}" reRender="outputpanel" >
                   <a4j:actionparam value="TestParam4" assignTo="#{testTabPanel.var4}" />
                   </a4j:commandLink>
                   </rich:tab>
                   </rich:tabPanel>
                   </a4j:form>
                   </a4j:outputPanel>
                   </a4j:region>
                   </f:view>
                   </body>
                  </html>
                  



                  And this Bean:
                  package net.wimaxxed.ajaxwebapp.webapp.bean;
                  
                  public class TestTabPanel
                  {
                   private String var1 = null;
                   private String var2 = null;
                   private String var3 = null;
                   private String var4 = null;
                  
                   public String actionMethod1()
                   {
                   System.out.println("CommandLink of 1st Tab called!");
                   return null;
                   }
                  
                   public String actionMethod2()
                   {
                   System.out.println("CommandLink of 2nd Tab called!");
                   return null;
                   }
                  
                   public String actionMethod3()
                   {
                   System.out.println("CommandLink of 3rd Tab called!");
                   return null;
                   }
                  
                   public String actionMethod4()
                   {
                   System.out.println("CommandLink of 4th Tab called!");
                   return null;
                   }
                  
                  // Getter and Setter - Methods:
                   public String getVar1() {
                   return var1;
                   }
                  
                   public void setVar1(String var1) {
                   System.out.println("Setting var1 to _> "+var1);
                   this.var1 = var1;
                   }
                  
                   public String getVar2() {
                   return var2;
                   }
                  
                   public void setVar2(String var2) {
                   System.out.println("Setting var2 to _> "+var2);
                   this.var2 = var2;
                   }
                  
                   public String getVar3() {
                   return var3;
                   }
                  
                   public void setVar3(String var3) {
                   System.out.println("Setting var3 to _> "+var3);
                   this.var3 = var3;
                   }
                  
                   public String getVar4() {
                   return var4;
                   }
                  
                   public void setVar4(String var4) {
                   System.out.println("Setting var4 to _> "+var4);
                   this.var4 = var4;
                   }
                  }
                  


                  This is the jboss-output after clicking the links in following order: commandlink1, commandlink2, cl3, cl4, cl3, cl2, cl1

                  .........
                  10:55:08,190 INFO [MyfacesConfig] Starting up Tomahawk on the MyFaces-JSF-Implementation
                  11:05:28,603 INFO [STDOUT] Setting var1 to _> TestParam1
                  11:05:28,603 INFO [STDOUT] CommandLink of 1st Tab called!
                  11:05:34,381 INFO [STDOUT] CommandLink of 2nd Tab called!
                  11:05:37,145 INFO [STDOUT] CommandLink of 3rd Tab called!
                  11:05:39,628 INFO [STDOUT] CommandLink of 4th Tab called!
                  11:05:42,158 INFO [STDOUT] CommandLink of 3rd Tab called!
                  11:05:44,157 INFO [STDOUT] CommandLink of 2nd Tab called!
                  11:05:46,266 INFO [STDOUT] Setting var1 to _> TestParam1
                  11:05:46,266 INFO [STDOUT] CommandLink of 1st Tab called!


                  You can see, that only the assigning of the first parameter with actionparam in first tab is running. Nothing else

                  • 6. Re: tabPanel - tabs - a4jcommandlink - actionparam
                    Ilya Shaikovsky Master

                    So thank for your submit.. Looks like the problem in the ajax4jsf inside myFaces environment. After I've switched my JSF 1.2.02 env to myFaces 1.1.5 - able to reproduce your problem.

                    • 8. Re: tabPanel - tabs - a4jcommandlink - actionparam
                      Patrick Ruhkopf Newbie

                      Today, I encountered the same problem. I could use a traditional f:param as a work-around. Maybe someone else finds this useful:

                      <a:commandLink id="clkEditEventDate" actionListener="#{eventSeriesManager.selectEventDate}" reRender="eventDateEditor">
                       <h:outputText value="Bearbeiten" />
                       <f:param name="eventDateId" value="#{eventDate.id}" />
                      </a:commandLink>
                      
                      public void selectEventDate(ActionEvent e)
                      {
                       FacesContext context = FacesContext.getCurrentInstance();
                       Map map = context.getExternalContext().getRequestParameterMap();
                       Long id = Long.parseLong((String) map.get("eventDateId"));
                       ?
                      }


                      • 9. Re: tabPanel - tabs - a4jcommandlink - actionparam
                        kiran sagi Newbie

                        I am facing the above issue with the traditional f:param toooo

                        • 10. Re: tabPanel - tabs - a4jcommandlink - actionparam
                          Flax Seed Newbie

                          I am as well. Please vote on this issue if you can.

                          • 11. Re: tabPanel - tabs - a4jcommandlink - actionparam
                            moldovan Newbie

                            As workaround i'm using the <t:updateActionListener> - Tag.
                            He fires before calling the action.

                            But it would be great, if the bug could be resolved quickly.

                            • 12. Re: tabPanel - tabs - a4jcommandlink - actionparam
                              Sergey Halipov Newbie

                              Try to specify 'name' attributes for a4j:actionparam tags. For example:

                              rich:tabPanel switchType="ajax" >
                              <rich:tab label="1. TAB" name="first" >
                              <h:outputText value="Here is commandLink No 1: " />
                              <a4j:commandLink id="commandlink1" value="just click"
                              action="#{testTabPanel.actionMethod1}" reRender="outputpanel">
                              <a4j:actionparam value="TestParam1"
                              assignTo="#{testTabPanel.var1}" name="param1" />
                              </a4j:commandLink>
                              </rich:tab>