Yes, maybe I've bean a little short...

I have defined a method 'onLoad' called at the renderResponse phase by a
facesListener and a method 'init' called by another facesListener at the
restoreView phase.  I don't understand 2 thing:

- why when I re-enter the page all faces phases are invoked also if the call
is a request and not a post (also if I set
org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION to 0 in the web.xml)

- why also if the 'init' method I've defined is invoked in the restoreView
phase and the model is updated than the view is not updated if a validation
is failed before

Thanks
Moreno

2008/10/16 Simon Kitching <[EMAIL PROTECTED]>

> Moreno Cornaz schrieb:
>
>  Hello
>>
>> I have a page with some input field whose values when I enter the page are
>> taken from a bean (and set in the onLoad of the page).
>> If I insert a value that cause the validation of that fields to fail and
>> than I quit the page, when I come back to that page
>> I found in the fields the values that made the validation failed instead
>> of the values from the bean.
>> I checked out and when i enter again the page after the validation the
>> model (the bean) is correctly set.
>> It seems that jsf keep ther view after the validation instead of restore
>> the new view when I enter again the page. But only if the validation fails!
>>
> That doesn't make sense. When you leave a page and then click a link to
> come back to it, a new view instance will be created so all data that was
> not successfully pushed into the model (ie which failed validation) *will*
> be lost. Always. If you're seeing something different, then your webapp must
> be doing something unusual that you haven't told us about.
>
> Are you perhaps using the browser "back" button? That probably does restore
> the original view together with invalid input, and that seems to me to be
> the right behaviour in that case.
>
> What do you mean by "set in onLoad"? There is no "onLoad" functionality in
> normal JSF...
>
> Regards,
> Simon
>
>

Reply via email to