users@javaserverfaces-spec-public.java.net

[jsr344-experts mirror] [jsr344-experts] Re: [758-ViewActions] PROPOSAL: Add getViewActions() (was: f:viewAction requires at least one f:viewParam into f:metadata section)

From: Leonardo Uribe <lu4242_at_gmail.com>
Date: Fri, 14 Dec 2012 11:17:28 -0500

Hi

2012/12/14 Edward Burns <edward.burns_at_oracle.com>:
>>>>>> On Thu, 13 Dec 2012 19:18:52 -0500, Leonardo Uribe <lu4242_at_gmail.com> said:
>
> LU> Hi
> LU> Implementing this feature in MyFaces, I notice that to make f:viewAction
> LU> work as expected, you need to set at least one f:viewParam in to the
> LU> page.
>
> LU> This happens because JSF 2.2 section 2.2.1 says this:
>
> LU> "... Call ViewMetadata.getViewParameters(). If the result is a non-empty
> LU> Collection, do not call facesContext.renderResponse() ..."
>
> LU> The idea is simple: only execute the full jsf lifecycle if required.
>
> Leo, thanks for catching this. I suggest the following.
>
> * Add to ViewMetadata
>
> public static Collection<UIViewAction> getViewActions(UIViewRoot root)
>
> * Modify 2.2.1 to also call ViewMetadata.getViewActions() and change the
> condition for not calling facesContext.renderResponse() to be if either
> collection is non-empty.
>
> What do you think?
>

I think it is ok, but being strict, the requeriment suggest activate
full lifecycle
processing at the presence of at least one UIViewAction or UIViewParameter.
But UIViewAction is different from UIViewParameter, because in the spec
there are parts when the collection of UIViewParameter is used, but the same
for UIViewAction is not strictly necessary. Why? because UIViewActions are
processed in the same order they are created inside the component tree,
so I can't imagine other situtation when the same requeriment arise.

I would suggest a method in ViewMetadata that do the check for execute
full lifecycle or avoid renderResponse() call, and the implementation by default
check for the existence of at least one UIViewParameter or UIViewAction.
In this way, the resposibility of this detail or the lifecycle is delegated to
the VDL. But maybe you don't really want to let that detail open by some
reason (note if you want to create a custom or similar view action component,
this detail suppose a difference between allow it or not without extend
UIViewParameter or UIViewAction component).

In conclusion, one way or another what matters here is allow f:viewAction
to be used without a dependency of f:viewParam, so any solution that
goes into that direction is ok.

regards.

Leonardo Uribe

> Ed
>
> --
> | edward.burns_at_oracle.com | office: +1 407 458 0017
> | homepage: | http://ridingthecrest.com/