[jsr-314-open] [2.0.MR1-698-RedirectParam] view-param is supposed to be redirect-param

Dan Allen dan.j.allen at gmail.com
Sun Dec 13 14:23:39 EST 2009


I've been meaning to file this issue for a while. I always seem to remember
when I am on stage giving a presentation, but not when at my computer :(

The <view-param> element that was introduced as a child of the <redirect>
element was supposed to be called <redirect-param>. Unfortunately, something
got
lost in translation and the terminology for "view parameters" got mixed up
with
redirect parameters. (I take the blame for not following up with a review of
this
topic in the spec document prior to final release).

I'll explain the difference. A view parameter is a mapping between a request
parameter and a bean property and is associated with a particular view ID.
If
you are linking or redirecting to that view ID, you can have those mappings
run
in reverse to build a query string. This is activated with the "include view
parameters" switch on the link (UIOutcomeTarget) component or <redirect>
element.

A redirect parameter in the navigation is equivalent to an <f:param> on a
button
or link. It is a manual setting, which may (or may not) override the value
of a
view parameter. A perfect example is when you want to create a link to the
previous page of a paginated list. You manually override "page" so that it
is
one less than the current page. <f:param name="page" value="#{nav.page -
1}"/>

<view-param> has no business being a child of <redirect> and should be
renamed
to <redirect-param>.

<navigation-case>
   <from-action>#{editor.save}</from-action>
   <from-outcome>success</from-outcome>
   <to-view-id>/entry.xhtml</to-view-id>
   <redirect>
      <redirect-param>
         <name>id</name>
         <value>#{entry.id}</value>
      </redirect-param>
   </redirect>
</navigation-case>

If you wanted to let view parameters manage the value of the "id" request
parameter, it would be:

<navigation-case>
   <from-action>#{editor.save}</from-action>
   <from-outcome>success</from-outcome>
   <to-view-id>/entry.xhtml</to-view-id>
   <redirect include-view-params="true"/>
</navigation-case>

/entry.xhtml
<f:view>
   <f:metadata>
      <f:viewParam name="id" value="#{entry.id}"/>
   </f:metadata>
   ...
</f:view>

See the difference?

-Dan

-- 
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://www.google.com/profiles/dan.j.allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20091213/155e89b3/attachment.html 


More information about the jsr-314-open-mirror mailing list