2 Replies Latest reply on Jul 2, 2009 12:38 AM by ninekays

    <f:actionParam> assignTo attribe does not assign value

    ninekays

      Hi all, im a newbie with richfaces, i hope u can help me with a problem that im having right now.

      here's the code;

      <h:panelGroup id="searchPanel">
      <h:form>
       <h:panelGrid columns="3" id="select_maker" cellpadding="2">
       <h:outputText value="Select handset maker"/>
       <h:outputText value=" "/>
       <h:selectOneMenu id="makers"
       value="#{gameHandsetController.makerId}"
       styleClass="select_handset">
       <f:selectItem itemValue="Please select one ..."/>
       <f:selectItems value="#{gameHandsetController.handsetMakerListSelectItems}"/>
       <a4j:support event="onchange" reRender="select_model, out"
       ajaxSingle="true"
       actionListener="#{gameHandsetController.changeMakerValue}"
       status="status"/>
       </h:selectOneMenu>
       </h:panelGrid>
      </h:form>
      
      <h:form>
       <h:panelGrid id="select_model" columns="3" cellpadding="2">
       <h:outputText value="Select handset model"/>
       <a4j:status id="status">
       <f:facet name="start">
       <h:graphicImage value="../images/ajax-loader-small.gif"/>
       </f:facet>
       </a4j:status>
       <h:selectOneMenu id="models"
       styleClass="select_handset"
       value="#{gameHandsetController.modelId}">
       <f:selectItems value="#{gameHandsetController.handsetModelListSelectItems}" />
       </h:selectOneMenu>
       </h:panelGrid>
       <a4j:commandButton reRender="gameList,out" ajaxSingle="true"
       actionListener="#{gameHandsetController.doSearch}"
       value="search">
       <a4j:actionparam assignTo="#{gameHandsetController.modelId}"
       value="#{gameHandsetController.modelId}"/>
       </a4j:commandButton>
      </h:form>
      </h:panelGroup>
      


      the problem is, when the command button is clicked, the value gameHandsetController.modelId is not assigned. Here's the code for gameHandssetController.doSearch.
      public void doSearch(ActionEvent event) {
       log.debug("modelId=" + modelId + " event=" + event.toString());
       retrieveGameList();
      }
      public void setModelId(String modelId) {
       log.debug("setModelId=" + modelId);
       this.modelId = modelId;
      }
      


      Here's what my log prints out (I put a log print in PhaseListener so I know what's going on)

      AccessFilter - doFilter: Requesting IP=127.0.0.1 accessing=/web/guide/gamehandsetsearch.jsf referred by=http://localhost/web/guide/gamehandsetsearch.jsf.
       PhaseListener - beforePhase: BEFORE RESTORE_VIEW 1
       PhaseListener - afterPhase: AFTER RESTORE_VIEW 1
       PhaseListener - beforePhase: BEFORE APPLY_REQUEST_VALUES 2
       PhaseListener - afterPhase: AFTER APPLY_REQUEST_VALUES 2
       PhaseListener - beforePhase: BEFORE PROCESS_VALIDATIONS 3
       PhaseListener - afterPhase: AFTER PROCESS_VALIDATIONS 3
       PhaseListener - beforePhase: BEFORE UPDATE_MODEL_VALUES 4
       PhaseListener - afterPhase: AFTER UPDATE_MODEL_VALUES 4
       PhaseListener - beforePhase: BEFORE INVOKE_APPLICATION 5
       GameHandsetController - <init>: params makerId=, pageNo=1
       GameHandsetController - doSearch: modelId=null event=javax.faces.event.ActionEvent[source=org.ajax4jsf.component.html.HtmlAjaxCommandButton@1d7e5f7]
       GameHandsetDAO - getGameHandset: GameHandsetDAO with param msId=null, pageNo=1
       GameHandsetController - setModelId: setModelId=
       GameHandsetDAO - getGameHandset: GameHandsetDAO with param msId=, pageNo=1
       PhaseListener - afterPhase: AFTER INVOKE_APPLICATION 5
       PhaseListener - beforePhase: BEFORE RENDER_RESPONSE 6
       PhaseListener - afterPhase: AFTER RENDER_RESPONSE 6
      
      


      Can anybody tell me what i did wrong?
      thank you in advance!