2 Replies Latest reply on Dec 4, 2009 8:08 PM by Thomas Barry

    Propagating request parameters question

    Thomas Barry Newbie

      Regarding page parameters, Section 6.4 in the Seam documentation states:

      If just the name attribute is specified then the request parameter is propagated using the PAGE context (it isn't mapped to model property).

      Propagation of page parameters is especially useful if you want to build multi-layer master-detail CRUD pages. You can use it to remember which view you were previously on (e.g. when pressing the Save button), and which entity you were editing.

      Any <s:link> or <s:button> transparently propagates the request parameter if that parameter is listed as a page parameter for the view.

      The value is transparently propagated with any JSF form submission for the page with the given view id. (This means that view parameters behave like PAGE-scoped context variables for faces requests.

      I'm sure it's just me, but I don't understand what this means.  When the documentation says 'The value is transparently propagated', what value is it talking about?  A value passed as a parameter from an <s:button>? And you'd have to get the value from the page context?


        • 1. Re: Propagating request parameters question
          Matthias Preier Newbie

          Hi, I belive it talks about the request parameter you can use for <s:button> and <s:link>. They are different from the normal parameters of a form, because they are send throu GET requests. Let me give you an example:

               <f:param name="foo" value="bar" />

          This button would generate an output like this:

          <input id="someButton" type="button"
               onclick="location.href='/yourApp/yourPage.seam?foo=bar&cid=1'; return false;"

          As you can see, the parameter now is included (transparently) into your URL (Thats the main difference between GET and POST). As described in the documentation you now can map these params to an bean (6.3) or to the page contex (6.4).
          If you wanna use these param in your action, you have to use the mapped value, get this value from the context or use the @RequestParameter annotation to inject the param (in my oppinion this is the easiest way).

          Somehow I even don't have to declare the params in the pages.xml and it stil works, but I'm not sure about this. I used Seam-gen and everthing works fine.

          I hope this will help you understand reqest params.

          • 2. Re: Propagating request parameters question
            Thomas Barry Newbie

            Thanks Matthias, that clears it up for me.