Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-192

inputParam component

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.0.9m9
    • 1.1.0
    • None
    • None
    • All

    Description

      inputParam extends inputHidden by adding an attribute, paramValue, which allows value binding predefined form values to a managed bean. For example, if you have a managed bean named searchBean with a setLastModified(Date d) method you can create a hidden form element with a preset date:

      <h:form>
      <h:commandLink action="searchBean.search">
      <x:inputParam value="#

      {searchBean.lastModified}

      " paramValue="04/05/2005">
      <f:convertDateTime type="date" dateStyle="short"/>
      </x:inputParam>
      </h:commandLink>
      </h:form>

      renders:

      <input type="hidden" value="04/05/2005"/>

      When the form is submitted searchBean.setLastModified is called with the Date object. When the link is clicked there is no need to look in the request for the parameters of the search. There is no need to modify the bean if a different search is required. Just create a new form/commandLink and specify the new parameters. I used it to create quick searches: New in last Day/Week/Month using the same bean for a full fledged form that let's the user specify the dates without having to modify the bean or tie it to faces/request to populate it.

      The attached archive contains the component package and the required xml fragments for the tld and faces-config.

      Attachments

        1. inputParam.tar.gz
          2 kB
          Rob Decker

        Activity

          People

            Unassigned Unassigned
            rdecker Rob Decker
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: