myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Delbecq <delbd+jaka...@oma.be>
Subject Re: Button must be clicked once before it could actually do something
Date Mon, 20 Aug 2007 10:02:02 GMT
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/


Mime
View raw message