10 Replies Latest reply on Oct 10, 2007 4:46 AM by Ilya Shaikovsky

    Need another pair of eyes... f:param not set in request

    Paul Baker Apprentice

      The value for param (selection) is not being set in the request map for a panelMenuItem.

      No matter what menu item I select the request map returns null for the param named: selection. What am I doing wrong?

      I need another pair of eyes to look at this code:

      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:f="http://java.sun.com/jsf/core" xml:lang="en" lang="en">
      
       <style>
       .cols{
       vertical-align:top;
       width:50%;
       }
       </style>
       <h:form id="form">
       <center>
       <h:outputText value="Flight Menu" styleClass="titleText"/>
       </center>
      
       <rich:spacer height="10" />
      
       <h:panelGrid columns="1" columnClasses="cols" width="100%">
       <rich:panelMenu style="width:200px"
       iconExpandedGroup="disc" iconCollapsedGroup="disc"
       iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right"
       iconCollapsedTopGroup="chevronDown" iconCollapsedTopPosition="right" >
       <rich:panelMenuGroup label="Flight Lists">
       <rich:panelMenuItem label="View All Flights" action="#{ldpMenuFlightDispatch.updateSelection}">
       <f:param name="selection" value="LDPDSPUC"/>
       </rich:panelMenuItem>
       <rich:panelMenuItem label="View My Flights" action="#{ldpMenuFlightDispatch.updateSelection}">
       <f:param name="selection" value="LDPDSPUC"/>
       </rich:panelMenuItem>
       <rich:panelMenuItem label="Manage My Flights" action="#{ldpMenuFlightDispatch.updateSelection}">
       <f:param name="selection" value="LDPDSPUC"/>
       </rich:panelMenuItem>
       </rich:panelMenuGroup>
       <rich:panelMenuGroup label="Flight Information">
       <rich:panelMenuItem label="Flight Progress" action="#{ldpMenuFlightDispatch.updateSelection}">
       <f:param name="selection" value="LDPDSPUC"/>
       </rich:panelMenuItem>
       <rich:panelMenuItem label="Flight Statistics" action="#{ldpMenuFlightDispatch.updateSelection}">
       <f:param name="selection" value="LDPDSPUC" />
       </rich:panelMenuItem>
       </rich:panelMenuGroup>
       <rich:panelMenuGroup label="Deadload">
       <rich:panelMenuItem label="View Deadload" action="#{ldpMenuFlightDispatch.updateSelection}">
       <f:param name="selection" value="LDPDSPUC" />
       </rich:panelMenuItem>
       <rich:panelMenuItem label="Assign Positions" action="#{ldpMenuFlightDispatch.updateSelection}">
       <f:param name="selection" value="LDPDSPALP"/>
       </rich:panelMenuItem>
       </rich:panelMenuGroup>
       <rich:panelMenuGroup label="Passengers">
       <rich:panelMenuItem label="View Passenger Load" action="#{ldpMenuFlightDispatch.updateSelection}">
       <f:param name="selection" value="LDPDSPUC"/>
       </rich:panelMenuItem>
       </rich:panelMenuGroup>
       <rich:panelMenuGroup label="Fuel">
       <rich:panelMenuItem label="View Fuel" action="#{ldpMenuFlightDispatch.updateSelection}">
       <f:param name="selection" value="LDPDSPUC"/>
       </rich:panelMenuItem>
       </rich:panelMenuGroup>
      
       </rich:panelMenu>
       </h:panelGrid>
       </h:form>
      </html>
      



      Code to look for Param named: selection. The result is always null. Why?

      public void updateSelection() {
       FacesContext facesContext = FacesContext.getCurrentInstance();
       Map params = facesContext.getExternalContext().getRequestParameterMap();
       String selection = (String) params.get("selection");
       if (selection != null) {
       menuState.setSelectedMenuItem(MenuConstants.LDPFeatureFlightDispatch, selection);
       }
       }
      


      Note: when mode is "ajax" the param IS set but my page is not re-rendered. Help!