Thanks David, let me put it this way:

reset server -> load page (Page A) --> click button -->  Show A again -->
click button again --> show B correctly

Cheers!

Fan



David Delbecq-2 wrote:
> 
> From what you say, i think what happens is
> 
> load page (Page A) --> reset server -> click button -->  Show A again
> 
> Am i wrong about the when server reset occurs?
> 
> 
> En l'instant précis du 20/08/07 12:40, Fan Shao s'exprimait en ces termes:
>> I thought the view has been rendered once before the button is clicked.
>>
>> My expected process is:
>>
>> load page (Page A) --> click button --> show another page({Page B)
>>
>> So, when the Page A is loaded, the view of this page is initialized, I
>> suppose? Then I click the button. At this point, the view has existed ?
>>
>> The actual process is (from user's perspective):
>>
>> load page(Page A) --> click button --> Page A reset and loaded again -->
>> click button (again) --> form submitted and another page shown(Page B).
>>
>> Cheers,
>>
>> Fan
>>
>>
>>
>>
>> David Delbecq-2 wrote:
>>   
>>> Extract from http://www.ibm.com/developerworks/library/j-jsf2/
>>> ---
>>> JSF lifecycle:
>>>
>>>    1. Restore view
>>>    2. Apply request values; process events
>>>    3. Process validations; process events
>>>    4. Update model values; process events
>>>    5. Invoke application; process events
>>>    6. Render response
>>>
>>> The JSF framework controller uses the view ID to look up the components
>>> for the current view. If the view doesn't already exist, the JSF
>>> controller creates it. If the view already exists, the JSF controller
>>> uses it. The view contains all the GUI components.
>>> This phase of the lifecycle presents three view instances: new view,
>>> initial view, and postback, with each one being handled differently.
>>> In the case of an /initial view/ (the first time a page is loaded), JSF
>>> creates an empty view. The empty view will be populated as the user
>>> causes events to occur. From an initial view, JSF advances directly to
>>> the render response phase.
>>> ---
>>>
>>> In your case, after your server restart, all views have been removed.
>>> That mean in first step you get a "initial view" that is wired to an
>>> immediate rendering. (Command and values you submit is thus ignored).
>>>
>>> One way around this, is to have your J2EE container (tomcat/JBoss/Other)
>>> preserve user sessions between restarts using serialization. That way,
>>> view are restored, because views are stored in user sessions.
>>>
>>>
>>> En l'instant précis du 20/08/07 11:48, Fan Shao s'exprimait en ces
>>> termes:
>>>     
>>>> Hi there,
>>>>
>>>> I've written a JSF page using Facelets template. I have a form in the
>>>> page
>>>> and a button. Every time I restarted the webapp, the first time I click
>>>> the
>>>> button it just refreshes the page and resets all the input fields.
>>>> After
>>>> that the button works normally with all the fields correctly submitted.
>>>>
>>>> This means I have to click the button once before I can do any work
>>>> everytime the server is restarted.
>>>>
>>>> Anyone has any idea about this problem?
>>>>   
>>>>       
>>> -- 
>>> http://www.noooxml.org/
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> -- 
> http://www.noooxml.org/
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Button-must-be-clicked-once-before-it-could-actually-do-something-tf4297733.html#a12234441
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to