2 Replies Latest reply on Dec 14, 2007 11:09 AM by Ivan Tufegdzic

    How can I "catch" query parameters and pass it to the form?

    Ivan Tufegdzic Newbie

      I have a query and when I run it.s. Base on these values, the query will return all records meeting the conditions. Now, I want to "catch" these values and use them as criteria to
      manipulate data from the query and show corresponding records on the form.

      I must not use annotation RequestParameter.
      I must use namepage.page.xml.

      Can you show me how to do it?

      Thank you,

        • 1. Re: How can I
          Andy Gibson Newbie


          Here's one source of documentation for it.

          Simply bind parameters in pages.xml to values in the backing component to get a 2 way passing of values from the form to the backing bean via request parameters.


          <page view-id="mySearch">
          <param name="lastName" value="#{myBean.lastName}">

          Now, when you call \mySearch.seam?lastName=smith the value will be put into the backing bean.

          On your form, you simply put :

           <h:inputText value="#{myBean.lastName}"/>

          and the parameter will appear in the form based on the parameter.

          So the parameter makes the trip from parameter in the request-> Put into the backing bean -> Value on the form bound to the backing bean.

          When you run the query, you can just refer to the lastName field in the MyBean class to get the value.

          • 2. Re: How can I
            Ivan Tufegdzic Newbie

            Yes, I understand.
            That works.
            I have dynamic list as parameters, and I don't have name (it will be unknown).
            I wrote a servlet which catch parameters with names and its values.
            That is good because in query I may put unknown names and its values.

            Is that ok?