[jsr-314-open-mirror] [jsr-314-open] Fwd: State saving of UIViewParameter

Martin Marinschek mmarinschek at apache.org
Tue May 11 18:08:43 EDT 2010


Jakob has answered in private mail (he has no write access here) that
he will add the spec issues.

Thanks Jakob!

best regards,

Martin

On 5/11/10, Martin Marinschek <mmarinschek at apache.org> wrote:
> Hi Jakob,
>
> thanks first for your very valuable input.
>
>> However I don't really like this solution, because we have to think of
>> handling UIViewParameters in a special way every time we change
>> something on any render mechanism. Why don't we just override
>> saveState() on UIViewParameter and set the submittedValue there before
>> the state is saved. This will have the same result, but without the
>> code in UIViewRoot, PartialViewContext and UIViewParameter.encodeAll()
>> and without future headaches. I also already uploaded a patch for this
>> to the MyFaces issue at [1].
>
> This is just a so much better solution ;). We should spec this one.
>
>> The second thing I want to bring up here is an issue I ran into while
>> testing the first one. Imagine you have a page with a required
>> UIViewParameter called input. You will get a validation error as long
>> as you don't access the view with ?input=abc. Now if you do that once,
>> "abc" will be saved as the submittedValue in the state of the
>> UIViewParameter for every postback and thus will be available for
>> every further postback. If you now access the view again with a GET
>> request (non-postback), but without ?input=abc, you will again get a
>> validation error. However, if you hit any button or link on the view
>> to generate another postback to the view, the validation error will be
>> gone, because UIViewParameter takes the value from before ("abc") out
>> of the model (managed-bean) and sets it in the state. Thus you haven't
>> provided it via ?input=abc, but you will now have a value of "abc" for
>> your UIViewParameter, which seems kinda wrong to me. The solution to
>> this one is to get the value from the model to set it as the
>> submittedValue in UIViewParameter only if the current request is a
>> postback. However I don't know if this really is an error or the
>> expected behaviour. I personally just think that it is weird.
>
> I absolutely agree that we should do this only on a postback -
> everything else is really, really weird behaviour. Can you file spec
> issues on this?
>
> best regards,
>
> Martin
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



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