You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Fan Shao <ra...@yahoo.com> on 2007/08/20 11:48:06 UTC
Button must be clicked once before it could actually do something
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?
--
View this message in context: http://www.nabble.com/Button-must-be-clicked-once-before-it-could-actually-do-something-tf4297733.html#a12232869
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: Button must be clicked once before it could actually do
something
Posted by Fan Shao <ra...@yahoo.com>.
I don't see the possibility of losing user session as all this happened
within a few seconds.
David Delbecq-2 wrote:
>
> And no session timeout between load page and click button?
> En l'instant précis du 20/08/07 14:20, Fan Shao s'exprimait en ces termes:
>> No message is shown by <h:messages/>.
>>
>> It seems it just refreshed the page when I clicked the button. Everything
>> was reset. I know the http request was correctly sent, because it worked
>> when I "refresh" the page using the browser's "refresh" button.
>>
>>
>>
>> David Delbecq-2 wrote:
>>
>>> no informations provided with <h:messages/> ??
>>> En l'instant précis du 20/08/07 13:57, Fan Shao s'exprimait en ces
>>> termes:
>>>
>>>> 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/
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> --
>>> 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#a12234990
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: Button must be clicked once before it could actually do something
Posted by David Delbecq <de...@oma.be>.
And no session timeout between load page and click button?
En l'instant précis du 20/08/07 14:20, Fan Shao s'exprimait en ces termes:
> No message is shown by <h:messages/>.
>
> It seems it just refreshed the page when I clicked the button. Everything
> was reset. I know the http request was correctly sent, because it worked
> when I "refresh" the page using the browser's "refresh" button.
>
>
>
> David Delbecq-2 wrote:
>
>> no informations provided with <h:messages/> ??
>> En l'instant précis du 20/08/07 13:57, Fan Shao s'exprimait en ces termes:
>>
>>> 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/
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>> --
>> http://www.noooxml.org/
>>
>>
>>
>>
>
>
--
http://www.noooxml.org/
Re: Button must be clicked once before it could actually do
something
Posted by Fan Shao <ra...@yahoo.com>.
No message is shown by <h:messages/>.
It seems it just refreshed the page when I clicked the button. Everything
was reset. I know the http request was correctly sent, because it worked
when I "refresh" the page using the browser's "refresh" button.
David Delbecq-2 wrote:
>
> no informations provided with <h:messages/> ??
> En l'instant précis du 20/08/07 13:57, Fan Shao s'exprimait en ces termes:
>> 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/
>>>
>>>
>>>
>>>
>>
>>
>
>
> --
> 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#a12234906
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: Button must be clicked once before it could actually do something
Posted by David Delbecq <de...@oma.be>.
no informations provided with <h:messages/> ??
En l'instant précis du 20/08/07 13:57, Fan Shao s'exprimait en ces termes:
> 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/
>>
>>
>>
>>
>
>
--
http://www.noooxml.org/
Re: Button must be clicked once before it could actually do
something
Posted by Fan Shao <ra...@yahoo.com>.
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.
Re: Button must be clicked once before it could actually do something
Posted by David Delbecq <de...@oma.be>.
>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/
Re: Button must be clicked once before it could actually do
something
Posted by Fan Shao <ra...@yahoo.com>.
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/
>
>
>
--
View this message in context: http://www.nabble.com/Button-must-be-clicked-once-before-it-could-actually-do-something-tf4297733.html#a12233633
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: Button must be clicked once before it could actually do something
Posted by David Delbecq <de...@oma.be>.
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/
Re: Button must be clicked once before it could actually do something
Posted by Christoph Ebner <ch...@gmail.com>.
Hi,
we've had a similar problem in our last project and narrowed it down to
caching in browsers and proxies.
you may try setting http-headers "pragma" to "no-store" and "cache-control"
to "no-cache".
We did it with a PhaseListener:
public void beforePhase(PhaseEvent event) {
FacesContext facesContext = event.getFacesContext();
HttpServletResponse servletResponse
= (HttpServletResponse) facesContext.getExternalContext
().getResponse();
servletResponse.setHeader("expires", "0");
servletResponse.setHeader("cache-control", "no-store");
servletResponse.setHeader("pragma", "no-cache");
}
public void afterPhase(PhaseEvent event) {
//do nothing
}
public PhaseId getPhaseId() {
return PhaseId.RENDER_RESPONSE;
}
cheers,
Christoph
-On 8/23/07, David Delbecq <de...@oma.be> wrote:
>
> Could it be there is a rendered=".." on or surrounding the button you try
> to use? If during the apply request value , the button is marked as not
> rendered, it's action won't be called. Try to reduce as much as possibile
> your form until you find what make it not working.
>
> Fan Shao a écrit :
>
> The action of the buttons didn't seem being called when that happened. I put
> a breakpoint in the action method and it was not fired up. It can be fired
> up normally when the button behaves normally. BTW, I am using Facelets. The
> filters defined in web.xml are Myfaces filters. I am using Tomahawk as well.
>
> A few more information. That page also has a drop-down box. I put a
> onclick="this.form.submit()" and valueChangeListener="xxx..." within the
> tag, so when I change the value of the drop-down box, it refreshes a
> textfield in the page. This drop-down box is working very well. As a
> comparison, the drop-down box works well and the button doesn't. However, I
> cannot find any clue from this.
>
> Lots of thanks again!
>
>
> Fan
>
>
>
> David Delbecq-2 wrote:
>
> Following what your said previously about this, i assume that
>
> 1) The view is in a restore state and not a create state (you mentionned
> clearly that you showed page *after* reloading page and *before*
> clicking button)
> 2) There are no validation problems (you stated <h:messages/> has empty
> output)
>
> Then i suggest you investigate your action methods, linked to the
> command param. It's probably that this action is sending a null or other
> incorrect result, for various reason that are related to your managed
> bean code. Check also that you have no third party filters that could
> interact with a POST to a url ending in ;JESSIONID=...., since, after
> first load of form, this is what the submit url will look like thanks to
> container url rewriting mecanism.
>
>
>
> En l'instant précis du 23/08/07 15:05, Fan Shao s'exprimait en ces termes:
>
> Hi, I've been stuck there for days. Could anyone help?
>
>
>
> Fan Shao wrote:
>
> 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/
>
>
>
>
>
Re: Button must be clicked once before it could actually do something
Posted by David Delbecq <de...@oma.be>.
Could it be there is a rendered=".." on or surrounding the button you
try to use? If during the apply request value , the button is marked as
not rendered, it's action won't be called. Try to reduce as much as
possibile your form until you find what make it not working.
Fan Shao a écrit :
> The action of the buttons didn't seem being called when that happened. I put
> a breakpoint in the action method and it was not fired up. It can be fired
> up normally when the button behaves normally. BTW, I am using Facelets. The
> filters defined in web.xml are Myfaces filters. I am using Tomahawk as well.
>
> A few more information. That page also has a drop-down box. I put a
> onclick="this.form.submit()" and valueChangeListener="xxx..." within the
> tag, so when I change the value of the drop-down box, it refreshes a
> textfield in the page. This drop-down box is working very well. As a
> comparison, the drop-down box works well and the button doesn't. However, I
> cannot find any clue from this.
>
> Lots of thanks again!
>
>
> Fan
>
>
>
> David Delbecq-2 wrote:
>
>> Following what your said previously about this, i assume that
>>
>> 1) The view is in a restore state and not a create state (you mentionned
>> clearly that you showed page *after* reloading page and *before*
>> clicking button)
>> 2) There are no validation problems (you stated <h:messages/> has empty
>> output)
>>
>> Then i suggest you investigate your action methods, linked to the
>> command param. It's probably that this action is sending a null or other
>> incorrect result, for various reason that are related to your managed
>> bean code. Check also that you have no third party filters that could
>> interact with a POST to a url ending in ;JESSIONID=...., since, after
>> first load of form, this is what the submit url will look like thanks to
>> container url rewriting mecanism.
>>
>>
>>
>> En l'instant précis du 23/08/07 15:05, Fan Shao s'exprimait en ces termes:
>>
>>> Hi, I've been stuck there for days. Could anyone help?
>>>
>>>
>>>
>>> Fan Shao wrote:
>>>
>>>
>>>> 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/
>>
>>
>>
>>
>
>
Re: Button must be clicked once before it could actually do
something
Posted by Fan Shao <ra...@yahoo.com>.
The action of the buttons didn't seem being called when that happened. I put
a breakpoint in the action method and it was not fired up. It can be fired
up normally when the button behaves normally. BTW, I am using Facelets. The
filters defined in web.xml are Myfaces filters. I am using Tomahawk as well.
A few more information. That page also has a drop-down box. I put a
onclick="this.form.submit()" and valueChangeListener="xxx..." within the
tag, so when I change the value of the drop-down box, it refreshes a
textfield in the page. This drop-down box is working very well. As a
comparison, the drop-down box works well and the button doesn't. However, I
cannot find any clue from this.
Lots of thanks again!
Fan
David Delbecq-2 wrote:
>
> Following what your said previously about this, i assume that
>
> 1) The view is in a restore state and not a create state (you mentionned
> clearly that you showed page *after* reloading page and *before*
> clicking button)
> 2) There are no validation problems (you stated <h:messages/> has empty
> output)
>
> Then i suggest you investigate your action methods, linked to the
> command param. It's probably that this action is sending a null or other
> incorrect result, for various reason that are related to your managed
> bean code. Check also that you have no third party filters that could
> interact with a POST to a url ending in ;JESSIONID=...., since, after
> first load of form, this is what the submit url will look like thanks to
> container url rewriting mecanism.
>
>
>
> En l'instant précis du 23/08/07 15:05, Fan Shao s'exprimait en ces termes:
>> Hi, I've been stuck there for days. Could anyone help?
>>
>>
>>
>> Fan Shao wrote:
>>
>>> 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/
>
>
>
--
View this message in context: http://www.nabble.com/Button-must-be-clicked-once-before-it-could-actually-do-something-tf4297733.html#a12294858
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: Button must be clicked once before it could actually do something
Posted by David Delbecq <de...@oma.be>.
Following what your said previously about this, i assume that
1) The view is in a restore state and not a create state (you mentionned
clearly that you showed page *after* reloading page and *before*
clicking button)
2) There are no validation problems (you stated <h:messages/> has empty
output)
Then i suggest you investigate your action methods, linked to the
command param. It's probably that this action is sending a null or other
incorrect result, for various reason that are related to your managed
bean code. Check also that you have no third party filters that could
interact with a POST to a url ending in ;JESSIONID=...., since, after
first load of form, this is what the submit url will look like thanks to
container url rewriting mecanism.
En l'instant précis du 23/08/07 15:05, Fan Shao s'exprimait en ces termes:
> Hi, I've been stuck there for days. Could anyone help?
>
>
>
> Fan Shao wrote:
>
>> 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/
Re: Button must be clicked once before it could actually do
something
Posted by Fan Shao <ra...@yahoo.com>.
Hi, I've been stuck there for days. Could anyone help?
Fan Shao wrote:
>
> 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?
>
--
View this message in context: http://www.nabble.com/Button-must-be-clicked-once-before-it-could-actually-do-something-tf4297733.html#a12293247
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Problem solved!!!
Posted by Fan Shao <ra...@yahoo.com>.
Hi there,
Thank u guys for your warm help, I eventually find out the cause of this
problem.
In that page I have a drop-down box, which has a "valueChangeListener", and
bound to a property of a managed bean.
When the managed bean is created, the default value of the drop-down
property was not set(ramains null). So when the first time the user visits
this page, and clicks the submit button, the "valueChangeEvent" is fired
(old value is null, now it gets a non-null value), and the response is sent
and the page is rendered in the "valueChangeListener". So for the user it
seems nothing is done but refreshing the screen when he clicks the button.
Assigning a default value to the drop-down box solves this problem.
Lots of thanks again!
Fan
Fan Shao wrote:
>
> 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?
>
--
View this message in context: http://www.nabble.com/Button-must-be-clicked-once-before-it-could-actually-do-something-tf4297733.html#a12464541
Sent from the MyFaces - Users mailing list archive at Nabble.com.