3 Replies Latest reply on Jun 30, 2008 12:05 PM by mail.micke

    Getting f:param in bean


      Hi all,

      I'm trying to get a f:param parameter in my backing bean, but I'm not able to find it.

      This is my

      <ui:define name="body">                
              <h:form id="ViewFormTypeForm">
                  <h2>Form Types : View</h2>
                  <rich:contextMenu attached="false" id="menu" submitMode="ajax">
                      <rich:menuItem ajaxSingle="true">
                          Edit <b>{formTypeName}</b> details
                          <a4j:support event="onclick" action="#{editFormTypeAction.setFormTypeToEdit()}" oncomplete="Richfaces.showModalPanel('EditFormTypePanel')"/>
                  <rich:dataTable value="#{formTypes}" 
                  <f:facet name="header">
                      <h:outputText value="#{messages.form_type}"/>
                  <rich:column sortBy="#{_formType.formTypeName}" filterBy="#{_formType.formTypeName}" filterEvent="onkeyup"> 
                      <f:facet name="header">
                          <h:outputText value="#{messages.form_type_name}"/>
                      <h:outputText value="#{_formType.formTypeName}"/>
                  <rich:column sortBy="#{_formType.remainingFormCopies}"> 
                      <f:facet name="header">
                          <h:outputText value="#{messages.form_type_remaining}"/>
                      <h:outputText value="#{_formType.remainingFormCopies}"/>
                  <rich:column sortBy="#{_formType.nbrOfUsedFormCopies}"> 
                      <f:facet name="header">
                          <h:outputText value="#{messages.form_type_nbr_of_used_form_copies}"/>
                      <h:outputText value="#{_formType.nbrOfUsedFormCopies}"/>
                  <rich:column sortBy="#{_formType.maxNbrOfFormCopies}"> 
                      <f:facet name="header">
                          <h:outputText value="#{messages.form_type_max_nbr_of_form_copies}"/>
                      <h:outputText value="#{_formType.maxNbrOfFormCopies}"/>
                  <rich:column sortBy="#{_formType.creationDate}"> 
                      <f:facet name="header">
                          <h:outputText value="#{messages.form_type_creation_date}"/>
                      <h:outputText value="#{_formType.creationDate}"/>
                      <f:facet name="header">
                          <h:outputText value="#{messages.pdf}"/>
                      <h:outputLink value="#{viewFormTypeAction.createPDF(_formType.formTypeName)}">
                          <h:graphicImage id="pdfimage"
                             alt="View PDF"
                             url="/images/pdf.jpg" width="15" height="15" style="border:0px">
                  <rich:componentControl event="onRowClick" for="menu" operation="show">
                      <f:param value="#{_formType.formTypeName}" name="formTypeName"/>
                  <a4j:outputPanel ajaxRendered="true" id>
                          <h:outputText value="#{editFormType.formTypeName}"></h:outputText>

      and in my bean

      formTypeName = (String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("ViewFormTypeForm.formTypeName");

      Any ideas?

        • 1. Re: Getting f:param in bean


          Can you find it by getting the value via the key formTypeName ?

          You can also try the below, will automatically set the value on the backing bean without having to go via the request parameter map. Haven't tried this with rich:componentControl , but works if inside a a4j:support.

          <a4j:actionparam name="someName" value="#{_formType.formTypeName}" assignTo="#{backingBean.property}" />


          • 2. Re: Getting f:param in bean

            Thanks, it works, but is there away to rerender a component inside the bean or after the property has been set?

            <a4j:support event="onRowClick" oncomplete="Richfaces.showModalPanel('EditFormType')" reRender="EditFormTypeDiv">
                            <a4j:actionparam name="formTypeName" value="#{_formType.formTypeName}" assignTo="#{editFormTypeAction.formTypeName}" />

            When I'm doing like this, it updates the area with the row data form my previous click, but I want to wait until the property has been updated (I'm using the parameter to retreive from my database and then I want to open a modal panel so that the user can edit the information).

            • 3. Re: Getting f:param in bean


              Here is a RichFaces Cookbook entry about using a modal panel for editing details based on clicking a link in a table.

              If the EditFormTypeDiv is the content of the modal panel which contains the area with editing information then I would have thought that your code would work.

              It submits the value, reRenders the modal panel content and then shows the modal panel doesn't it.

              If it doesn't work, please post the modal panel related xhtml.