1 Reply Latest reply on Jan 18, 2010 5:14 PM by Nick Belaevski

    Response of a4j:commandlink Issue

    Chris Alexander Newbie

      Hello All,

       

      I have the following problem when clicking a a4j:commandlink with action attribute set. I am new to RichFaces and would sincerely appreciate any help you can provide. Thank you...

       

      Here is the a4j:log output:

       

      debug[15:22:42,274]: Have Event [object Object] with properties: target: http://localhost:8080/oaAjaxAdminConsole/#, srcElement: undefined, type: click
      debug[15:22:42,274]: Query preparation for form 'j_id15' requested
      debug[15:22:42,275]: Append hidden control j_id15 with value [j_id15] and value attribute [j_id15]
      debug[15:22:42,276]: Append hidden control autoScroll with value [] and value attribute []
      debug[15:22:42,277]: Append hidden control javax.faces.ViewState with value [j_id1] and value attribute [j_id1]
      debug[15:22:42,277]: parameter j_id15:acmdlkMainMenuInventory with value j_id15:acmdlkMainMenuInventory
      debug[15:22:42,278]: Look up queue with default name
      debug[15:22:42,278]: NEW AJAX REQUEST !!! with form: j_id15
      debug[15:22:42,279]: Start XmlHttpRequest
      debug[15:22:42,280]: Request state : 1
      debug[15:22:42,281]: QueryString: AJAXREQUEST=j_id15%3Amainmenu_region&j_id15=j_id15&autoScroll=&javax.faces.ViewState=j_id1&j_id15%3AacmdlkMainMenuInventory=j_id15%3AacmdlkMainMenuInventory&
      debug[15:22:42,287]: Request state : 1
      debug[15:22:42,511]: Request state : 2
      debug[15:22:42,513]: Request state : 3
      debug[15:22:42,513]: Request state : 4
      debug[15:22:42,514]: Request end with state 4
      debug[15:22:42,514]: Response  with content-type: text/xml;charset=UTF-8
      debug[15:22:42,514]: Full response content: <?xml version="1.0"?>  <html xmlns="http://www.w3.org/1999/xhtml"><head><title></title><link class="component" href="/oaAjaxAdminConsole/a4j/s/3_3_2.SR1org/richfaces/renderkit/html/css/basic_both.xcss/DATB/eAELXT5DOhSIAQ!sA18_.jsf" rel="stylesheet" type="text/css" /><link class="component" href="/oaAjaxAdminConsole/a4j/s/3_3_2.SR1org/richfaces/renderkit/html/css/extended_both.xcss/DATB/eAELXT5DOhSIAQ!sA18_.jsf" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org.ajax4jsf.javascript.AjaxScript.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/ajax4jsf/javascript/scripts/form.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org.ajax4jsf.javascript.PrototypeScript.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/jquery/jquery.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/jquery.utils.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/json/json-mini.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org.ajax4jsf.javascript.DnDScript.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/utils.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/json/json-dom.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/dnd/dnd-common.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/form.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/events.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/tree.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/tree-selection.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/tree-item.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/tree-item-dnd.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/drag-indicator.js.jsf" type="text/javascript">  </script><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/browser_info.js.jsf" type="text/javascript">  </script><link class="component" href="/oaAjaxAdminConsole/a4j/s/3_3_2.SR1org/richfaces/renderkit/html/css/dragIndicator.xcss/DATB/eAELXT5DOhSIAQ!sA18_.jsf" rel="stylesheet" type="text/css" /><link class="component" href="/oaAjaxAdminConsole/a4j/s/3_3_2.SR1css/tree.xcss/DATB/eAELXT5DOhSIAQ!sA18_.jsf" rel="stylesheet" type="text/css" /><script src="/oaAjaxAdminConsole/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/skinning.js.jsf" type="text/javascript">  </script></head><body><div xmlns:rich="http://richfaces.ajax4jsf.org/rich"></div><meta name="Ajax-Update-Ids" content="" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id1" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /></body></html>
      debug[15:22:42,520]: Header Ajax-Expired not found, search in <meta>
      debug[15:22:42,520]: search for elements by name 'meta'  in element #document
      debug[15:22:42,524]: Find <meta name='Ajax-Update-Ids' content=''>
      debug[15:22:42,524]: Find <meta name='Ajax-Response' content='true'>
      debug[15:22:42,524]: Header Ajax-Update-Ids not found, search in <meta>
      debug[15:22:42,524]: search for elements by name 'meta'  in element #document
      debug[15:22:42,527]: Find <meta name='Ajax-Update-Ids' content=''>
      warn[15:22:42,528]: No information in response about elements to replace
      debug[15:22:42,528]: call getElementById for id= org.ajax4jsf.oncomplete
      debug[15:22:42,528]: Processing updates finished, no oncomplete function to call
      debug[15:22:42,528]: call getElementById for id= ajax-view-state
      debug[15:22:42,528]: Hidden JSF state fields: [object HTMLSpanElement]
      debug[15:22:42,528]: Namespace for hidden view-state input fields is undefined
      debug[15:22:42,529]: search for elements by name 'input'  in element span
      debug[15:22:42,531]: Replace value for inputs: 8 by new values: 1
      debug[15:22:42,532]: Input in response: javax.faces.ViewState
      debug[15:22:42,532]: Found same input on page with type: hidden
      debug[15:22:42,532]: Found same input on page with type: hidden
      debug[15:22:42,532]: Found same input on page with type: hidden
      debug[15:22:42,532]: search for elements by name 'INPUT'  in element span
      debug[15:22:42,535]: Replace value for inputs: 8 by new values: 0
      debug[15:22:42,535]: call getElementById for id= _A4J.AJAX.focus
      debug[15:22:42,536]: No focus information in response

       

      Here is the mark-up from a facelet composition:

       

      <a4j:form>
              <a4j:region id="mainmenu_region">
                  <a4j:commandLink id="acmdlkMainMenuHome" value="Home" action="#{mainmenu.onHomeClick}" style="#{mainmenu.mainMenuHomeStyle}" />
                  <h:outputText id="otxtHomeOrdersSep" style="color:#999999;font-size:16px;font-weight:bold;padding:10px 20px 10px 20px;" value="|"/>
                  <a4j:commandLink id="acmdlkMainMenuOrders" value="Orders" action="#{mainmenu.onOrdersClick}" style="#{mainmenu.mainMenuOrdersStyle}" />
                  <h:outputText id="otxtOrdersFulfillmentSep"
                      style="color:#999999;font-size:16px;font-weight:bold;padding:10px 20px 10px 20px;" value="|"/>
                  <a4j:commandLink id="acmdlkMainMenuFulfillment" action="#{mainmenu.onFilfillmentClick}" style="#{mainmenu.mainMenuFulfillmentStyle}" value="Fulfillment" />
                  <h:outputText id="otxtFulfillmentInventorySep"
                      style="color:#999999;font-size:16px;font-weight:bold;padding:10px 20px 10px 20px;" value="|"/>
                  <a4j:commandLink id="acmdlkMainMenuInventory" action="#{mainmenu.onInventoryClick}" style="#{mainmenu.mainMenuInventoryStyle}" value="Inventory" />
                  <h:outputText id="otxtInventoryPricingSep"
                      style="color:#999999;font-size:16px;font-weight:bold;padding:10px 20px 10px 20px;" value="|"/>
                  <a4j:commandLink id="acmdlkMainMenuPricing" action="#{mainmenu.onPricingClick}" style="#{mainmenu.mainMenuPricingStyle}" value="Pricing" />
                  <h:outputText id="otxtPricingAnalyticsSep"
                      style="color:#999999;font-size:16px;font-weight:bold;padding:10px 20px 10px 20px;" value="|"/>
                  <a4j:commandLink id="acmdlkMainMenuAnalytics" action="#{mainmenu.onAnalyticsClick}" style="#{mainmenu.mainMenuAnalyticsStyle}" value="Analytics" />
                  <h:outputText id="otxtAnalyticsOrganizationSep"
                      style="color:#999999;font-size:16px;font-weight:bold;padding:10px 20px 10px 20px;" value="|"/>
                  <a4j:commandLink id="acmdlkMainMenuOrganization" action="#{mainmenu.onOrganizationClick}" style="#{mainmenu.mainMenuOrganizationStyle}" value="Organization" />
                  <h:outputText id="otxtOrganizationMyConsoleSep"
                      style="color:#999999;font-size:16px;font-weight:bold;padding:10px 20px 10px 20px;" value="|"/>
                  <a4j:commandLink id="acmdlkMainMenuMyConsole" action="#{mainmenu.onMyConsoleClick}" style="#{mainmenu.mainMenuMyConsoleStyle}" value="My Console" />
              </a4j:region>
          </a4j:form>

       

      Here is the session-scoped managed bean:

       

      // <editor-fold defaultstate="collapsed" desc="Component Actions">
          public void onHomeClick() {
              try {
                  if (!this._MainMenuItem.equals(enumFaceletMainMenuView.home)) {
                      this._MainMenuItem = enumFaceletMainMenuView.home;
                  }
                  //return null;
              }
              catch (Exception e) {
                  //return null;
              }
          }

       

          public void onOrdersClick() {
              try {
                  if (!this._MainMenuItem.equals(enumFaceletMainMenuView.orders)) {
                      this._MainMenuItem = enumFaceletMainMenuView.orders;
                  }
                  //return null;
              }
              catch (Exception e) {
                  //return null;
              }
          }

       

          public void onFulfillmentClick() {
              try {
                  if (!this._MainMenuItem.equals(enumFaceletMainMenuView.fulfillment)) {
                      this._MainMenuItem = enumFaceletMainMenuView.fulfillment;
                  }
                  //return null;
              }
              catch (Exception e) {
                  //return null;
              }
          }

       

          public void onInventoryClick() {
              try {
                  if (!this._MainMenuItem.equals(enumFaceletMainMenuView.inventory)) {
                      this._MainMenuItem = enumFaceletMainMenuView.inventory;
                  }
                  //return null;
              }
              catch (Exception e) {
                  //return null;
              }
          }

       

          public void onPricingClick() {
              try {
                  if (!this._MainMenuItem.equals(enumFaceletMainMenuView.pricing)) {
                      this._MainMenuItem = enumFaceletMainMenuView.pricing;
                  }
                  //return null;
              }
              catch (Exception e) {
                  //return null;
              }
          }

       

          public void onOrganizationClick() {
              try {
                  if (!this._MainMenuItem.equals(enumFaceletMainMenuView.organization)) {
                      this._MainMenuItem = enumFaceletMainMenuView.organization;
                  }
                  //return null;
              }
              catch (Exception e) {
                  //return null;
              }
          }

       

          public void onAnalyticsClick() {
              try {
                  if (!this._MainMenuItem.equals(enumFaceletMainMenuView.analytics)) {
                      this._MainMenuItem = enumFaceletMainMenuView.analytics;
                  }
                  //return null;
              }
              catch (Exception e) {
                  //return null;
              }
          }

       

          public void onMyConsoleClick() {
              try {
                  if (!this._MainMenuItem.equals(enumFaceletMainMenuView.myconsole)) {
                      this._MainMenuItem = enumFaceletMainMenuView.myconsole;
                  }
                  //return null;
              }
              catch (Exception e) {
                  //return null;
              }
          }
          //</editor-fold>

       

          //<editor-fold defaultstate="collasped" desc="Properties">
          public String getMainMenuHomeStyle() {
              if (this._MainMenuItem.equals(enumFaceletMainMenuView.home))
                  return this._SC.getAttribute("mainmenu_active").toString();
              else
                  return this._SC.getAttribute("mainmenu_inactive").toString();
          }
         
          public String getMainMenuOrdersStyle() {
              if (this._MainMenuItem.equals(enumFaceletMainMenuView.orders))
                  return this._SC.getAttribute("mainmenu_active").toString();
              else
                  return this._SC.getAttribute("mainmenu_inactive").toString();
          }

       

          public String getMainMenuFulfillmentStyle() {
              if (this._MainMenuItem.equals(enumFaceletMainMenuView.fulfillment))
                  return this._SC.getAttribute("mainmenu_active").toString();
              else
                  return this._SC.getAttribute("mainmenu_inactive").toString();
          }

       

          public String getMainMenuInventoryStyle() {
              if (this._MainMenuItem.equals(enumFaceletMainMenuView.inventory))
                  return this._SC.getAttribute("mainmenu_active").toString();
              else
                  return this._SC.getAttribute("mainmenu_inactive").toString();
          }

       

          public String getMainMenuPricingStyle() {
              if (this._MainMenuItem.equals(enumFaceletMainMenuView.pricing))
                  return this._SC.getAttribute("mainmenu_active").toString();
              else
                  return this._SC.getAttribute("mainmenu_inactive").toString();
          }

       

          public String getMainMenuAnalyticsStyle() {
              if (this._MainMenuItem.equals(enumFaceletMainMenuView.analytics))
                  return this._SC.getAttribute("mainmenu_active").toString();
              else
                  return this._SC.getAttribute("mainmenu_inactive").toString();
          }

       

          public String getMainMenuOrganizationStyle() {
              if (this._MainMenuItem.equals(enumFaceletMainMenuView.organization))
                  return this._SC.getAttribute("mainmenu_active").toString();
              else
                  return this._SC.getAttribute("mainmenu_inactive").toString();
          }

       

          public String getMainMenuMyConsoleStyle() {
              if (this._MainMenuItem.equals(enumFaceletMainMenuView.myconsole))
                  return this._SC.getAttribute("mainmenu_active").toString();
              else
                  return this._SC.getAttribute("mainmenu_inactive").toString();
          }
          //</editor-fold>