On 24 Oct 2008, at 20:10, Dan Allen wrote:
Pete feels that I clouded the issue with my previous response. I
will
try again this time addressing Christian's proposal directly.
Thanks :-)
On Fri, Oct 24, 2008 at 7:48 AM, Christian Bauer
<christian.bauer(a)gmail.com> wrote:
>
> On Oct 24, 2008, at 13:21 , Pete Muir wrote:
>
>> As Christian said, <f:param name="whatever" /> is probably the
wrong
>> syntax for this, as it implies you are adding a parameter, not
>> removing it.
>> Maybe we need an <s:suppressPageParameter name="foo" /> instead.
>
> -1, just document <f:param name="foo" value="#{null}"/> and
that's
> it for
> suppressing a page parameter. Overriding is then consistent with
> <f:param
> name="foo" value="#{override}"/>. This would be the easiest
> solution. Any
> syntax we come up with to do the same in a different way is going
> to be more
> complex.
Agreed.
Also, these two are exactly the same in the eyes of Facelets:
<f:param name="foo"/>
<f:param name="foo" value="#{null}"/>
We cannot enforce one or the other since Facelets doesn't enforce one
or the other.
Actually it is possible to differentiate between the two in JSF
(nothing to do with facelets).
if (parameter.getValueExpression("value") == null) {
// The markup was <f:param name="foo"/>
} else if (parameter.getValue() == null) {
/ // The markup was <f:param name="foo" value="#{null}"/>
}
> Or/and we do this:
>
> <page view-id="one.xhtml">
> <param name="foo" value="#{binding.getterAndSetter"/>
> <param name="bar" value="#{binding.getterAndSetter"/>
> </page>
>
> Regular link that evaluates #{binding.getterAndSetter} to get the
> "foo" and
> "bar" parameter values (that's the (current) default):
>
> <s:link view-id="one.xhtml" page-parameters="override"/>
I don't get the point of "override" here. Let's just keep the current
behavior of incorporating the page parameters into the URL as the
default.
<s:link view="/one.xhtml" value="One"/>
> Link that only contains the "bar" parameter with
> #{binding.getterAndSetter}
> value:
>
> <s:link view-id="one.xhtml" page-parameters="override">
> <f:param name="foo"/>
> </s:link:
Yep, this was the logic I just added in Seam 2.1. As you mentioned
above, you could also do <f:param name="foo" value="#{null}"/>.
I
still don't see the need for the "override". The very presence of
<f:param> implies an override.
Christian, did you mean it this way around? To me, this syntax would
create a link that only had the *foo* parameter (that's the way you
described it to me on IM):
<s:link view="one.xhtml" pageParameters="override">
<f:param name="foo"/>
</s:link>
and this only a bar parameter:
<s:link view="one.xhtml" pageParameters="override">
<f:param name="bar"/>
</s:link>
So, specifying override requires you to specify any parameters you
want to propagate on the link. Specifying a param without the value
will cause the default value to be used from pages.xml, or you can
specify a value.
> Link that only contains the "bar" parameter with #{binding.other}
> value:
>
> <s:link view-id="one.xhtml" page-parameters="override">
> <f:param name="foo"/>
> <f:param name="bar" value="#{binding.other}"/>
> </s:link:>
Agreed, but again, don't need the "override".
So in my scheme, this would propagate both foo and bar, with foo using
it's default value.
> Link that only contains the "foo" parameter with
> #{binding.getterAndSetter}
> value:
>
> <s:link view-id="one.xhtml" page-parameters="ignore">
> <f:param name="foo"/>
> </s:link>
Under my scheme we don't need "ignore" , you would use:
<s:link view="one.xhtml" pageParameters="override">
<f:param name="foo"/>
</s:link>
>
The general idea is correct here, except foo is only included if a
value is provided (to be consistent with what was said above). I also
have a different idea for the attribute that controls the use of the
page parameters. How about this?
<s:link view="/one.xhtml" value="One"
encodePageParameters="false">
<f:param name="foo" value="anyOldValue"/>
</s:link>
Encode isn't right, as that (to me) refers to encoding the parameter
strings.
> Link that only includes the "foo" parameter with #{binding.other}
> value:
>
> <s:link view-id="one.xhtml" page-parameters="ignore">
> <f:param name="foo" value="#{binding.other}"/>
> </s:link>
This is really the same as
<s:link view="one.xhtml" pageParameters="override">
<f:param name="foo" value="#{binding.other}" />
</s:link>
>
And again my suggestion:
<s:link view="/one.xhtml" value="One"
encodePageParameters="false">
<f:param name="foo" value="#{binding.other}"/>
</s:link>
> The advantage here is that we can keep it backwards compatible, if
> you have
> the default page-parameters="override", the #{null} trick, the ""
> value
> trick, and the no-value-attribute all continue to work as before.
I'm really not sure that the no-value-attribute is correct, so I think
we should change it to your original suggestion Christian - that it
causes a parameter to be propagated with the value got from pages.xml.
I think as this is a new minor feature we can break it.
>
Yes, this is definitely going to be easy to make backward compatible.
By default it will encode the page parameters unless the
encodePageParameters="false" is added to the Seam command component.
The name for this attribute is open to discussion. Recall that we need
this attribute on the <redirect> component in the page descriptor as
well.