[seam-dev] Suppressing parameter inclusion for s:link
Dan Allen
dan.j.allen at gmail.com
Fri Oct 24 15:10:19 EDT 2008
Pete feels that I clouded the issue with my previous response. I will
try again this time addressing Christian's proposal directly.
On Fri, Oct 24, 2008 at 7:48 AM, Christian Bauer
<christian.bauer at 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.
> 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.
> 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".
> 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>
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>
> 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>
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.
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.
-Dan
--
Dan Allen
Software consultant | Author of Seam in Action
http://mojavelinux.com
http://mojavelinux.com/seaminaction
NOTE: While I make a strong effort to keep up with my email on a daily
basis, personal or other work matters can sometimes keep me away
from my email. If you contact me, but don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters. Please don't hesitate to resend a message if
you feel that it did not reach my attention.
More information about the seam-dev
mailing list