You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Vinayak Borkar <vb...@yahoo.com> on 2009/03/31 08:30:52 UTC

Page instantiated twice

Hello,


I have a form that performs a search and shows a page with results. The 
result page also has the same form to do a repeat search. I noticed that 
the SearchPage is instantiated twice when I do a search from the form on 
the result page. Is there a way to make sure that does not happen? The 
search page ends up doing the search twice.

Thanks,
Vinayak

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Esteban Masoero <em...@getsense.com.ar>.
Ok, I understand.
In case I come up with a solution, I'll let you know to see what you think.
In the meantime, I'll do some workaround considering your suggestion.

Thanks!

Esteban

Igor Vaynberg escribió:
> we could not think of a different solution, maybe you can come up with
> one. we do not know if the page is opened in a new tab until it is
> fully loaded and we can check via javascript the name of the window.
>
> to fix this you can try storing your messages in your own collection
> and somehow figuring out when to clear them.
>
> -igor
>
> On Wed, Oct 21, 2009 at 12:25 PM, Esteban Masoero
> <em...@getsense.com.ar> wrote:
>   
>> Any comments about this? could It be a bug? If there's no other way of
>> achieving the multiwindow feature that doesn't include instanciating the
>> page again, maybe something could be done to avoid that the first instance
>> consumes the session messages, because as we see this first page instance
>> isn't the one that will be seen in the browser.
>>
>> what do you think?
>>
>> Esteban
>>
>>
>> Esteban Masoero escribió:
>>     
>>> That is correct. I'm openning the page in a new tab just because of the
>>> process registration I'm doing:
>>> - user registers
>>> - app sends him an email with a generated link
>>> - user clicks that link from his email page, which it's oppened in a new
>>> window/tab (there's no way It can be openned in its previous app page, where
>>> he recently registered)
>>>
>>> And as I said in another email, I've found out that setting
>>> getPageSettings().setAutomaticMultiWindowSupport(false); solves the problem.
>>> However, I'm lossing the multi-window feature and I'm not sure I want that.
>>>
>>> Isn't a way that the new page can use a copy of the session used by the
>>> old page? (although I guess a copy of the session should be made before its
>>> feeedback messages are consumed) Because as I see, there's no way that I can
>>> leave a feedback message to the session and so that message can be shown in
>>> a new window, because of this feature.
>>>
>>> Thanks,
>>>
>>> Esteban
>>>
>>>
>>>
>>> Igor Vaynberg escribió:
>>>       
>>>> are you opening the page in a new tab? this script is part of wicket
>>>> auto-multi-window support, it detects if the page has been opened in a
>>>> new tab and redirects to a url that will point to the same page but in
>>>> a new pagemap.
>>>>
>>>> -igor
>>>>
>>>> On Tue, Oct 20, 2009 at 4:23 PM, Esteban Masoero
>>>> <em...@getsense.com.ar> wrote:
>>>>
>>>>         
>>>>> First of all, thanks to all of you for your help.
>>>>> I haven't solved the problem, but I'm getting closer to it.
>>>>> (something like: new PageLink(new MyPage()); <= I checked it and I'm not
>>>>> doing that. )
>>>>>
>>>>> Here's what I've found out:
>>>>>
>>>>> After debugging a lot, I find out that TWO REQUESTS are made. The first
>>>>> one
>>>>> as a consecuence of the user asking for that page, and the second one
>>>>> because in that page the following script is added at the end of <head>
>>>>> tag:
>>>>> <script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
>>>>> if (window.name=='' || (window.name.indexOf('wicket') > -1 &&
>>>>> window.name!='wicket-wicket:default')) {
>>>>>
>>>>> window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage"
>>>>> + (window.location.hash != null ? window.location.hash : ""); }
>>>>> /*-->]]>*/</script>
>>>>>
>>>>> Can anyone tell me why is Wicket doing that? or what am I doing wrong?
>>>>>
>>>>>
>>>>>
>>>>> |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
>>>>> Here's the complete detailed description about what I am doing:
>>>>>
>>>>>       A UserStatusPanel that is always shown does *new Link("register")*
>>>>> with:
>>>>>       @Override
>>>>>               public void onClick() {
>>>>>                       throw new
>>>>> RestartResponseAtInterceptPageException(UserRegistrationPage.class);
>>>>>               }
>>>>>
>>>>>       When the user gets to the page, submmits its registration data and
>>>>> the page sends an email with a link like:
>>>>> http://localhost:8080/ua?ua=2baab43f784b5b530b5347a50490bb0a
>>>>>
>>>>>
>>>>>       In my webApp, I've done:
>>>>>       this.mount(new QueryStringUrlCodingStrategy("/ua",
>>>>> UserActivationPage.class));
>>>>>
>>>>>       When the user goes to the previous mentioned link by a new tab,
>>>>> the
>>>>> following happens:
>>>>>
>>>>>       _______________________
>>>>>       GET /ua?ua=2e129db15b6d6db5342ba5d328642262 HTTP/1.1
>>>>>       Host: localhost:8080
>>>>>       ....
>>>>>       Connection: keep-alive
>>>>>       Cookie: JSESSIONID=78ehtk0o3y0w
>>>>>       _______________________________
>>>>>       === IN org.apache.wicket.RequestCycle.processEventsAndRespond()
>>>>> ===
>>>>>       --processor.processEvents(this);
>>>>>       ---- UserActivationPage is constructed, and the page activates the
>>>>> user
>>>>>       ---- UserActivationPage does: setResponsePage(LoginPage.class);
>>>>>       --processor.respond(this);
>>>>>       ----LoginPage is constructed (messages exists in session and are
>>>>> properly rendered to somewhere)
>>>>>
>>>>> ===================================================================
>>>>>       [I can see in firebug that the correct response reaches the
>>>>> browser!]
>>>>>
>>>>>       Strangely, In the page, wicket adds:        <script
>>>>> type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
>>>>> if (window.name=='' || (window.name.indexOf('wicket') > -1 &&
>>>>> window.name!='wicket-wicket:default')) {
>>>>>
>>>>> window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage"
>>>>> + (window.location.hash != null ? window.location.hash : ""); }
>>>>> /*-->]]>*/</script>
>>>>>
>>>>>       [So a new request is made!]
>>>>>       ___________________________________________
>>>>>       GET
>>>>>
>>>>> /ua?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage
>>>>> HTTP/1.1
>>>>>       Host: localhost:8080
>>>>>       ...
>>>>>       Connection: keep-alive
>>>>>       Referer:
>>>>> http://localhost:8080/ua?ua=2e129db15b6d6db5342ba5d328642262
>>>>>       Cookie: JSESSIONID=78ehtk0o3y0w
>>>>>       ________________________________________________
>>>>>       === IN org.apache.wicket.RequestCycle.processEventsAndRespond()
>>>>> ===
>>>>>       --processor.processEvents(this);
>>>>>       ---- LoginPage is constructed (not UserActivationPage like it did
>>>>> before) (this time, messages from the session are gonne)
>>>>>       --processor.respond(this); finally this page is shown without my
>>>>> messages :(
>>>>>
>>>>> ===================================================================
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>>
>>>>> Esteban
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Martin Grigorov escribió:
>>>>>
>>>>>           
>>>>>> El mar, 20-10-2009 a las 15:04 -0700, Douglas Ferguson escribió:
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> You can also check your html to make sure there aren't any urls that
>>>>>>>  would get loaded by the browser.
>>>>>>>
>>>>>>> i.e. <link>, <img>, etc tags..
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> yeah, <img src="" ... /> will make a second request to the page. quite
>>>>>> nasty!
>>>>>> fortunately there is a checker for these kind of problems in
>>>>>> wicket-devutils project
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> D/
>>>>>>>
>>>>>>>
>>>>>>> On Oct 20, 2009, at 4:39 PM, Jeremy Thomerson wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>> Have you followed the suggestions in this thread?
>>>>>>>>
>>>>>>>> First, put a breakpoint to see what's instantiating the page - the
>>>>>>>>  most
>>>>>>>> likely suspect for an unintended additional instantiation is a bad
>>>>>>>>  link,
>>>>>>>> something like: new PageLink(new MyPage());   <--- shouldn't do that
>>>>>>>>
>>>>>>>> If it's Wicket code, what code is it?  Why?  It might be stateless as
>>>>>>>> Martijn suggested.
>>>>>>>>
>>>>>>>> --
>>>>>>>> Jeremy Thomerson
>>>>>>>> http://www.wickettraining.com
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Oct 20, 2009 at 4:23 PM, Esteban Ignacio Masoero <
>>>>>>>> emasoero@getsense.com.ar> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> Hi there. I'm bringing to life this old thread to ask whether this
>>>>>>>>>  issue
>>>>>>>>> was
>>>>>>>>> solved and how, because I'm experiencing something alike, which
>>>>>>>>> makes
>>>>>>>>> session messsages to get lost ("consummed" by the first instance of
>>>>>>>>>  the
>>>>>>>>> page), and consecuently not shown by the second page instance.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>>
>>>>>>>>> Esteban
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Vinayak Borkar wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>>>> Martijn,
>>>>>>>>>>
>>>>>>>>>> Ok. I set the getStatelessHint() to return false.
>>>>>>>>>>
>>>>>>>>>> Now I get java.lang.IllegalStateException: No SessionHandler or
>>>>>>>>>> SessionManager
>>>>>>>>>>
>>>>>>>>>> What is the reason that wicket needs to instantiate the page
>>>>>>>>>>  twice? I
>>>>>>>>>> can understand the second instantiation, but my guess is that the
>>>>>>>>>>  first
>>>>>>>>>> instantiation is not to render the HTML.
>>>>>>>>>>
>>>>>>>>>> If I am correct about my analysis above, is there some way I can
>>>>>>>>>>  know
>>>>>>>>>> that the instantiation does not need to populate all the
>>>>>>>>>> components?
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>>
>>>>>>>>>> Vinayak
>>>>>>>>>>
>>>>>>>>>> Martijn Dashorst wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                     
>>>>>>>>>>> Your page is stateless, which is a holy grail for most to attend.
>>>>>>>>>>>  Be
>>>>>>>>>>> happy :)
>>>>>>>>>>>
>>>>>>>>>>> Since it is stateless, Wicket has to construct the page with each
>>>>>>>>>>> request, until it is no longer stateless.
>>>>>>>>>>>
>>>>>>>>>>> If you have a form, override its getstatelesshint method and
>>>>>>>>>>> return
>>>>>>>>>>> false.
>>>>>>>>>>>
>>>>>>>>>>> Martijn
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                       
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>>>>>> Jeremy,
>>>>>>>>>>>>
>>>>>>>>>>>> I did that. The first time it is
>>>>>>>>>>>>
>>>>>>>>>>>> at
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                         
>>>>>>>>> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents
>>>>>>>>> (BookmarkableListenerInterfaceRequestTarget.java:127)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>>>>>> and the second time it is
>>>>>>>>>>>>
>>>>>>>>>>>> at
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                         
>>>>>>>>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents
>>>>>>>>> (BookmarkablePageRequestTarget.java:223)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>>>>>> Does that help?
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks,
>>>>>>>>>>>> Vinayak
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Jeremy Thomerson wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                         
>>>>>>>>>>>>> Run it in debug mode, put a breakpoint in your constructor and
>>>>>>>>>>>>>  see
>>>>>>>>>>>>> what's
>>>>>>>>>>>>> instantiating each.  A lot of times it is your own code (a bad
>>>>>>>>>>>>>  link,
>>>>>>>>>>>>> etc).
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> Jeremy Thomerson
>>>>>>>>>>>>> http://www.wickettraining.com
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar
>>>>>>>>>>>>>  <vb...@yahoo.com>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>                           
>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I have a form that performs a search and shows a page with
>>>>>>>>>>>>>>  results.
>>>>>>>>>>>>>> The
>>>>>>>>>>>>>> result page also has the same form to do a repeat search. I
>>>>>>>>>>>>>>  noticed
>>>>>>>>>>>>>> that
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>> SearchPage is instantiated twice when I do a search from the
>>>>>>>>>>>>>>  form
>>>>>>>>>>>>>> on
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>> result page. Is there a way to make sure that does not happen?
>>>>>>>>>>>>>>  The
>>>>>>>>>>>>>> search
>>>>>>>>>>>>>> page ends up doing the search twice.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>>> Vinayak
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>                             
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                         
>>>>>>>>>>>                       
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                     
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>> http://www.nabble.com/Page-instantiated-twice-
>>>>>>>>> tp22799162p25982806.html
>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>>         
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Igor Vaynberg <ig...@gmail.com>.
we could not think of a different solution, maybe you can come up with
one. we do not know if the page is opened in a new tab until it is
fully loaded and we can check via javascript the name of the window.

to fix this you can try storing your messages in your own collection
and somehow figuring out when to clear them.

-igor

On Wed, Oct 21, 2009 at 12:25 PM, Esteban Masoero
<em...@getsense.com.ar> wrote:
> Any comments about this? could It be a bug? If there's no other way of
> achieving the multiwindow feature that doesn't include instanciating the
> page again, maybe something could be done to avoid that the first instance
> consumes the session messages, because as we see this first page instance
> isn't the one that will be seen in the browser.
>
> what do you think?
>
> Esteban
>
>
> Esteban Masoero escribió:
>>
>> That is correct. I'm openning the page in a new tab just because of the
>> process registration I'm doing:
>> - user registers
>> - app sends him an email with a generated link
>> - user clicks that link from his email page, which it's oppened in a new
>> window/tab (there's no way It can be openned in its previous app page, where
>> he recently registered)
>>
>> And as I said in another email, I've found out that setting
>> getPageSettings().setAutomaticMultiWindowSupport(false); solves the problem.
>> However, I'm lossing the multi-window feature and I'm not sure I want that.
>>
>> Isn't a way that the new page can use a copy of the session used by the
>> old page? (although I guess a copy of the session should be made before its
>> feeedback messages are consumed) Because as I see, there's no way that I can
>> leave a feedback message to the session and so that message can be shown in
>> a new window, because of this feature.
>>
>> Thanks,
>>
>> Esteban
>>
>>
>>
>> Igor Vaynberg escribió:
>>>
>>> are you opening the page in a new tab? this script is part of wicket
>>> auto-multi-window support, it detects if the page has been opened in a
>>> new tab and redirects to a url that will point to the same page but in
>>> a new pagemap.
>>>
>>> -igor
>>>
>>> On Tue, Oct 20, 2009 at 4:23 PM, Esteban Masoero
>>> <em...@getsense.com.ar> wrote:
>>>
>>>>
>>>> First of all, thanks to all of you for your help.
>>>> I haven't solved the problem, but I'm getting closer to it.
>>>> (something like: new PageLink(new MyPage()); <= I checked it and I'm not
>>>> doing that. )
>>>>
>>>> Here's what I've found out:
>>>>
>>>> After debugging a lot, I find out that TWO REQUESTS are made. The first
>>>> one
>>>> as a consecuence of the user asking for that page, and the second one
>>>> because in that page the following script is added at the end of <head>
>>>> tag:
>>>> <script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
>>>> if (window.name=='' || (window.name.indexOf('wicket') > -1 &&
>>>> window.name!='wicket-wicket:default')) {
>>>>
>>>> window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage"
>>>> + (window.location.hash != null ? window.location.hash : ""); }
>>>> /*-->]]>*/</script>
>>>>
>>>> Can anyone tell me why is Wicket doing that? or what am I doing wrong?
>>>>
>>>>
>>>>
>>>> |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
>>>> Here's the complete detailed description about what I am doing:
>>>>
>>>>       A UserStatusPanel that is always shown does *new Link("register")*
>>>> with:
>>>>       @Override
>>>>               public void onClick() {
>>>>                       throw new
>>>> RestartResponseAtInterceptPageException(UserRegistrationPage.class);
>>>>               }
>>>>
>>>>       When the user gets to the page, submmits its registration data and
>>>> the page sends an email with a link like:
>>>> http://localhost:8080/ua?ua=2baab43f784b5b530b5347a50490bb0a
>>>>
>>>>
>>>>       In my webApp, I've done:
>>>>       this.mount(new QueryStringUrlCodingStrategy("/ua",
>>>> UserActivationPage.class));
>>>>
>>>>       When the user goes to the previous mentioned link by a new tab,
>>>> the
>>>> following happens:
>>>>
>>>>       _______________________
>>>>       GET /ua?ua=2e129db15b6d6db5342ba5d328642262 HTTP/1.1
>>>>       Host: localhost:8080
>>>>       ....
>>>>       Connection: keep-alive
>>>>       Cookie: JSESSIONID=78ehtk0o3y0w
>>>>       _______________________________
>>>>       === IN org.apache.wicket.RequestCycle.processEventsAndRespond()
>>>> ===
>>>>       --processor.processEvents(this);
>>>>       ---- UserActivationPage is constructed, and the page activates the
>>>> user
>>>>       ---- UserActivationPage does: setResponsePage(LoginPage.class);
>>>>       --processor.respond(this);
>>>>       ----LoginPage is constructed (messages exists in session and are
>>>> properly rendered to somewhere)
>>>>
>>>> ===================================================================
>>>>       [I can see in firebug that the correct response reaches the
>>>> browser!]
>>>>
>>>>       Strangely, In the page, wicket adds:        <script
>>>> type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
>>>> if (window.name=='' || (window.name.indexOf('wicket') > -1 &&
>>>> window.name!='wicket-wicket:default')) {
>>>>
>>>> window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage"
>>>> + (window.location.hash != null ? window.location.hash : ""); }
>>>> /*-->]]>*/</script>
>>>>
>>>>       [So a new request is made!]
>>>>       ___________________________________________
>>>>       GET
>>>>
>>>> /ua?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage
>>>> HTTP/1.1
>>>>       Host: localhost:8080
>>>>       ...
>>>>       Connection: keep-alive
>>>>       Referer:
>>>> http://localhost:8080/ua?ua=2e129db15b6d6db5342ba5d328642262
>>>>       Cookie: JSESSIONID=78ehtk0o3y0w
>>>>       ________________________________________________
>>>>       === IN org.apache.wicket.RequestCycle.processEventsAndRespond()
>>>> ===
>>>>       --processor.processEvents(this);
>>>>       ---- LoginPage is constructed (not UserActivationPage like it did
>>>> before) (this time, messages from the session are gonne)
>>>>       --processor.respond(this); finally this page is shown without my
>>>> messages :(
>>>>
>>>> ===================================================================
>>>>
>>>> Thanks in advance,
>>>>
>>>>
>>>> Esteban
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Martin Grigorov escribió:
>>>>
>>>>>
>>>>> El mar, 20-10-2009 a las 15:04 -0700, Douglas Ferguson escribió:
>>>>>
>>>>>
>>>>>>
>>>>>> You can also check your html to make sure there aren't any urls that
>>>>>>  would get loaded by the browser.
>>>>>>
>>>>>> i.e. <link>, <img>, etc tags..
>>>>>>
>>>>>>
>>>>>
>>>>> yeah, <img src="" ... /> will make a second request to the page. quite
>>>>> nasty!
>>>>> fortunately there is a checker for these kind of problems in
>>>>> wicket-devutils project
>>>>>
>>>>>
>>>>>>
>>>>>> D/
>>>>>>
>>>>>>
>>>>>> On Oct 20, 2009, at 4:39 PM, Jeremy Thomerson wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Have you followed the suggestions in this thread?
>>>>>>>
>>>>>>> First, put a breakpoint to see what's instantiating the page - the
>>>>>>>  most
>>>>>>> likely suspect for an unintended additional instantiation is a bad
>>>>>>>  link,
>>>>>>> something like: new PageLink(new MyPage());   <--- shouldn't do that
>>>>>>>
>>>>>>> If it's Wicket code, what code is it?  Why?  It might be stateless as
>>>>>>> Martijn suggested.
>>>>>>>
>>>>>>> --
>>>>>>> Jeremy Thomerson
>>>>>>> http://www.wickettraining.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Oct 20, 2009 at 4:23 PM, Esteban Ignacio Masoero <
>>>>>>> emasoero@getsense.com.ar> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Hi there. I'm bringing to life this old thread to ask whether this
>>>>>>>>  issue
>>>>>>>> was
>>>>>>>> solved and how, because I'm experiencing something alike, which
>>>>>>>> makes
>>>>>>>> session messsages to get lost ("consummed" by the first instance of
>>>>>>>>  the
>>>>>>>> page), and consecuently not shown by the second page instance.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Esteban
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Vinayak Borkar wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Martijn,
>>>>>>>>>
>>>>>>>>> Ok. I set the getStatelessHint() to return false.
>>>>>>>>>
>>>>>>>>> Now I get java.lang.IllegalStateException: No SessionHandler or
>>>>>>>>> SessionManager
>>>>>>>>>
>>>>>>>>> What is the reason that wicket needs to instantiate the page
>>>>>>>>>  twice? I
>>>>>>>>> can understand the second instantiation, but my guess is that the
>>>>>>>>>  first
>>>>>>>>> instantiation is not to render the HTML.
>>>>>>>>>
>>>>>>>>> If I am correct about my analysis above, is there some way I can
>>>>>>>>>  know
>>>>>>>>> that the instantiation does not need to populate all the
>>>>>>>>> components?
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>>
>>>>>>>>> Vinayak
>>>>>>>>>
>>>>>>>>> Martijn Dashorst wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Your page is stateless, which is a holy grail for most to attend.
>>>>>>>>>>  Be
>>>>>>>>>> happy :)
>>>>>>>>>>
>>>>>>>>>> Since it is stateless, Wicket has to construct the page with each
>>>>>>>>>> request, until it is no longer stateless.
>>>>>>>>>>
>>>>>>>>>> If you have a form, override its getstatelesshint method and
>>>>>>>>>> return
>>>>>>>>>> false.
>>>>>>>>>>
>>>>>>>>>> Martijn
>>>>>>>>>>
>>>>>>>>>> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Jeremy,
>>>>>>>>>>>
>>>>>>>>>>> I did that. The first time it is
>>>>>>>>>>>
>>>>>>>>>>> at
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents
>>>>>>>> (BookmarkableListenerInterfaceRequestTarget.java:127)
>>>>>>>>
>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> and the second time it is
>>>>>>>>>>>
>>>>>>>>>>> at
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents
>>>>>>>> (BookmarkablePageRequestTarget.java:223)
>>>>>>>>
>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Does that help?
>>>>>>>>>>>
>>>>>>>>>>> Thanks,
>>>>>>>>>>> Vinayak
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Jeremy Thomerson wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Run it in debug mode, put a breakpoint in your constructor and
>>>>>>>>>>>>  see
>>>>>>>>>>>> what's
>>>>>>>>>>>> instantiating each.  A lot of times it is your own code (a bad
>>>>>>>>>>>>  link,
>>>>>>>>>>>> etc).
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Jeremy Thomerson
>>>>>>>>>>>> http://www.wickettraining.com
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar
>>>>>>>>>>>>  <vb...@yahoo.com>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I have a form that performs a search and shows a page with
>>>>>>>>>>>>>  results.
>>>>>>>>>>>>> The
>>>>>>>>>>>>> result page also has the same form to do a repeat search. I
>>>>>>>>>>>>>  noticed
>>>>>>>>>>>>> that
>>>>>>>>>>>>> the
>>>>>>>>>>>>> SearchPage is instantiated twice when I do a search from the
>>>>>>>>>>>>>  form
>>>>>>>>>>>>> on
>>>>>>>>>>>>> the
>>>>>>>>>>>>> result page. Is there a way to make sure that does not happen?
>>>>>>>>>>>>>  The
>>>>>>>>>>>>> search
>>>>>>>>>>>>> page ends up doing the search twice.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>> Vinayak
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://www.nabble.com/Page-instantiated-twice-
>>>>>>>> tp22799162p25982806.html
>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Esteban Masoero <em...@getsense.com.ar>.
Any comments about this? could It be a bug? If there's no other way of 
achieving the multiwindow feature that doesn't include instanciating the 
page again, maybe something could be done to avoid that the first 
instance consumes the session messages, because as we see this first 
page instance isn't the one that will be seen in the browser.

what do you think?

Esteban


Esteban Masoero escribió:
> That is correct. I'm openning the page in a new tab just because of 
> the process registration I'm doing:
> - user registers
> - app sends him an email with a generated link
> - user clicks that link from his email page, which it's oppened in a 
> new window/tab (there's no way It can be openned in its previous app 
> page, where he recently registered)
>
> And as I said in another email, I've found out that setting 
> getPageSettings().setAutomaticMultiWindowSupport(false); solves the 
> problem. However, I'm lossing the multi-window feature and I'm not 
> sure I want that.
>
> Isn't a way that the new page can use a copy of the session used by 
> the old page? (although I guess a copy of the session should be made 
> before its feeedback messages are consumed) Because as I see, there's 
> no way that I can leave a feedback message to the session and so that 
> message can be shown in a new window, because of this feature.
>
> Thanks,
>
> Esteban
>
>
>
> Igor Vaynberg escribió:
>> are you opening the page in a new tab? this script is part of wicket
>> auto-multi-window support, it detects if the page has been opened in a
>> new tab and redirects to a url that will point to the same page but in
>> a new pagemap.
>>
>> -igor
>>
>> On Tue, Oct 20, 2009 at 4:23 PM, Esteban Masoero
>> <em...@getsense.com.ar> wrote:
>>  
>>> First of all, thanks to all of you for your help.
>>> I haven't solved the problem, but I'm getting closer to it.
>>> (something like: new PageLink(new MyPage()); <= I checked it and I'm 
>>> not
>>> doing that. )
>>>
>>> Here's what I've found out:
>>>
>>> After debugging a lot, I find out that TWO REQUESTS are made. The 
>>> first one
>>> as a consecuence of the user asking for that page, and the second one
>>> because in that page the following script is added at the end of 
>>> <head> tag:
>>> <script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
>>> if (window.name=='' || (window.name.indexOf('wicket') > -1 &&
>>> window.name!='wicket-wicket:default')) {
>>> window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage" 
>>>
>>> + (window.location.hash != null ? window.location.hash : ""); }
>>> /*-->]]>*/</script>
>>>
>>> Can anyone tell me why is Wicket doing that? or what am I doing wrong?
>>>
>>>
>>> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
>>>
>>> Here's the complete detailed description about what I am doing:
>>>
>>>        A UserStatusPanel that is always shown does *new 
>>> Link("register")*
>>> with:
>>>        @Override
>>>                public void onClick() {
>>>                        throw new
>>> RestartResponseAtInterceptPageException(UserRegistrationPage.class);
>>>                }
>>>
>>>        When the user gets to the page, submmits its registration 
>>> data and
>>> the page sends an email with a link like:
>>> http://localhost:8080/ua?ua=2baab43f784b5b530b5347a50490bb0a
>>>
>>>
>>>        In my webApp, I've done:
>>>        this.mount(new QueryStringUrlCodingStrategy("/ua",
>>> UserActivationPage.class));
>>>
>>>        When the user goes to the previous mentioned link by a new 
>>> tab, the
>>> following happens:
>>>
>>>        _______________________
>>>        GET /ua?ua=2e129db15b6d6db5342ba5d328642262 HTTP/1.1
>>>        Host: localhost:8080
>>>        ....
>>>        Connection: keep-alive
>>>        Cookie: JSESSIONID=78ehtk0o3y0w
>>>        _______________________________
>>>        === IN 
>>> org.apache.wicket.RequestCycle.processEventsAndRespond() ===
>>>        --processor.processEvents(this);
>>>        ---- UserActivationPage is constructed, and the page 
>>> activates the
>>> user
>>>        ---- UserActivationPage does: setResponsePage(LoginPage.class);
>>>        --processor.respond(this);
>>>        ----LoginPage is constructed (messages exists in session and are
>>> properly rendered to somewhere)
>>>        
>>> ===================================================================
>>>        [I can see in firebug that the correct response reaches the 
>>> browser!]
>>>
>>>        Strangely, In the page, wicket adds:        <script
>>> type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
>>> if (window.name=='' || (window.name.indexOf('wicket') > -1 &&
>>> window.name!='wicket-wicket:default')) {
>>> window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage" 
>>>
>>> + (window.location.hash != null ? window.location.hash : ""); }
>>> /*-->]]>*/</script>
>>>
>>>        [So a new request is made!]
>>>        ___________________________________________
>>>        GET
>>> /ua?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage 
>>>
>>> HTTP/1.1
>>>        Host: localhost:8080
>>>        ...
>>>        Connection: keep-alive
>>>        Referer: 
>>> http://localhost:8080/ua?ua=2e129db15b6d6db5342ba5d328642262
>>>        Cookie: JSESSIONID=78ehtk0o3y0w
>>>        ________________________________________________
>>>        === IN 
>>> org.apache.wicket.RequestCycle.processEventsAndRespond() ===
>>>        --processor.processEvents(this);
>>>        ---- LoginPage is constructed (not UserActivationPage like it 
>>> did
>>> before) (this time, messages from the session are gonne)
>>>        --processor.respond(this); finally this page is shown without my
>>> messages :(
>>>        
>>> ===================================================================
>>>
>>> Thanks in advance,
>>>
>>>
>>> Esteban
>>>
>>>
>>>
>>>
>>>
>>>
>>> Martin Grigorov escribió:
>>>    
>>>> El mar, 20-10-2009 a las 15:04 -0700, Douglas Ferguson escribió:
>>>>
>>>>      
>>>>> You can also check your html to make sure there aren't any urls that
>>>>>  would get loaded by the browser.
>>>>>
>>>>> i.e. <link>, <img>, etc tags..
>>>>>
>>>>>         
>>>> yeah, <img src="" ... /> will make a second request to the page. quite
>>>> nasty!
>>>> fortunately there is a checker for these kind of problems in
>>>> wicket-devutils project
>>>>
>>>>      
>>>>> D/
>>>>>
>>>>>
>>>>> On Oct 20, 2009, at 4:39 PM, Jeremy Thomerson wrote:
>>>>>
>>>>>
>>>>>        
>>>>>> Have you followed the suggestions in this thread?
>>>>>>
>>>>>> First, put a breakpoint to see what's instantiating the page - 
>>>>>> the  most
>>>>>> likely suspect for an unintended additional instantiation is a bad
>>>>>>  link,
>>>>>> something like: new PageLink(new MyPage());   <--- shouldn't do that
>>>>>>
>>>>>> If it's Wicket code, what code is it?  Why?  It might be 
>>>>>> stateless as
>>>>>> Martijn suggested.
>>>>>>
>>>>>> -- 
>>>>>> Jeremy Thomerson
>>>>>> http://www.wickettraining.com
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Oct 20, 2009 at 4:23 PM, Esteban Ignacio Masoero <
>>>>>> emasoero@getsense.com.ar> wrote:
>>>>>>
>>>>>>
>>>>>>          
>>>>>>> Hi there. I'm bringing to life this old thread to ask whether this
>>>>>>>  issue
>>>>>>> was
>>>>>>> solved and how, because I'm experiencing something alike, which 
>>>>>>> makes
>>>>>>> session messsages to get lost ("consummed" by the first instance of
>>>>>>>  the
>>>>>>> page), and consecuently not shown by the second page instance.
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Esteban
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Vinayak Borkar wrote:
>>>>>>>
>>>>>>>            
>>>>>>>> Martijn,
>>>>>>>>
>>>>>>>> Ok. I set the getStatelessHint() to return false.
>>>>>>>>
>>>>>>>> Now I get java.lang.IllegalStateException: No SessionHandler or
>>>>>>>> SessionManager
>>>>>>>>
>>>>>>>> What is the reason that wicket needs to instantiate the page  
>>>>>>>> twice? I
>>>>>>>> can understand the second instantiation, but my guess is that the
>>>>>>>>  first
>>>>>>>> instantiation is not to render the HTML.
>>>>>>>>
>>>>>>>> If I am correct about my analysis above, is there some way I 
>>>>>>>> can  know
>>>>>>>> that the instantiation does not need to populate all the 
>>>>>>>> components?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Vinayak
>>>>>>>>
>>>>>>>> Martijn Dashorst wrote:
>>>>>>>>
>>>>>>>>              
>>>>>>>>> Your page is stateless, which is a holy grail for most to 
>>>>>>>>> attend.  Be
>>>>>>>>> happy :)
>>>>>>>>>
>>>>>>>>> Since it is stateless, Wicket has to construct the page with each
>>>>>>>>> request, until it is no longer stateless.
>>>>>>>>>
>>>>>>>>> If you have a form, override its getstatelesshint method and 
>>>>>>>>> return
>>>>>>>>> false.
>>>>>>>>>
>>>>>>>>> Martijn
>>>>>>>>>
>>>>>>>>> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar 
>>>>>>>>> <vb...@yahoo.com>
>>>>>>>>>
>>>>>>>>>                 
>>>>>>> wrote:
>>>>>>>
>>>>>>>            
>>>>>>>>>> Jeremy,
>>>>>>>>>>
>>>>>>>>>> I did that. The first time it is
>>>>>>>>>>
>>>>>>>>>> at
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                   
>>>>>>> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents 
>>>>>>>
>>>>>>> (BookmarkableListenerInterfaceRequestTarget.java:127)
>>>>>>>
>>>>>>>            
>>>>>>>>>> and the second time it is
>>>>>>>>>>
>>>>>>>>>> at
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                   
>>>>>>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents 
>>>>>>>
>>>>>>> (BookmarkablePageRequestTarget.java:223)
>>>>>>>
>>>>>>>            
>>>>>>>>>> Does that help?
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> Vinayak
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Jeremy Thomerson wrote:
>>>>>>>>>>
>>>>>>>>>>                  
>>>>>>>>>>> Run it in debug mode, put a breakpoint in your constructor 
>>>>>>>>>>> and  see
>>>>>>>>>>> what's
>>>>>>>>>>> instantiating each.  A lot of times it is your own code (a bad
>>>>>>>>>>>  link,
>>>>>>>>>>> etc).
>>>>>>>>>>>
>>>>>>>>>>> -- 
>>>>>>>>>>> Jeremy Thomerson
>>>>>>>>>>> http://www.wickettraining.com
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar  
>>>>>>>>>>> <vb...@yahoo.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                    
>>>>>>>>>>>> Hello,
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> I have a form that performs a search and shows a page with
>>>>>>>>>>>>  results.
>>>>>>>>>>>> The
>>>>>>>>>>>> result page also has the same form to do a repeat search. I
>>>>>>>>>>>>  noticed
>>>>>>>>>>>> that
>>>>>>>>>>>> the
>>>>>>>>>>>> SearchPage is instantiated twice when I do a search from 
>>>>>>>>>>>> the  form
>>>>>>>>>>>> on
>>>>>>>>>>>> the
>>>>>>>>>>>> result page. Is there a way to make sure that does not happen?
>>>>>>>>>>>>  The
>>>>>>>>>>>> search
>>>>>>>>>>>> page ends up doing the search twice.
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks,
>>>>>>>>>>>> Vinayak
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>>>>
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                       
>>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>>
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                   
>>>>>>>>>                 
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>               
>>>>>>> -- 
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/Page-instantiated-twice- 
>>>>>>> tp22799162p25982806.html
>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>         
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>>       
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>     
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>   
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Esteban Masoero <em...@getsense.com.ar>.
That is correct. I'm openning the page in a new tab just because of the 
process registration I'm doing:
- user registers
- app sends him an email with a generated link
- user clicks that link from his email page, which it's oppened in a new 
window/tab (there's no way It can be openned in its previous app page, 
where he recently registered)

And as I said in another email, I've found out that setting 
getPageSettings().setAutomaticMultiWindowSupport(false); solves the 
problem. However, I'm lossing the multi-window feature and I'm not sure 
I want that.

Isn't a way that the new page can use a copy of the session used by the 
old page? (although I guess a copy of the session should be made before 
its feeedback messages are consumed) Because as I see, there's no way 
that I can leave a feedback message to the session and so that message 
can be shown in a new window, because of this feature.

Thanks,

Esteban



Igor Vaynberg escribió:
> are you opening the page in a new tab? this script is part of wicket
> auto-multi-window support, it detects if the page has been opened in a
> new tab and redirects to a url that will point to the same page but in
> a new pagemap.
>
> -igor
>
> On Tue, Oct 20, 2009 at 4:23 PM, Esteban Masoero
> <em...@getsense.com.ar> wrote:
>   
>> First of all, thanks to all of you for your help.
>> I haven't solved the problem, but I'm getting closer to it.
>> (something like: new PageLink(new MyPage()); <= I checked it and I'm not
>> doing that. )
>>
>> Here's what I've found out:
>>
>> After debugging a lot, I find out that TWO REQUESTS are made. The first one
>> as a consecuence of the user asking for that page, and the second one
>> because in that page the following script is added at the end of <head> tag:
>> <script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
>> if (window.name=='' || (window.name.indexOf('wicket') > -1 &&
>> window.name!='wicket-wicket:default')) {
>> window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage"
>> + (window.location.hash != null ? window.location.hash : ""); }
>> /*-->]]>*/</script>
>>
>> Can anyone tell me why is Wicket doing that? or what am I doing wrong?
>>
>>
>> |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
>> Here's the complete detailed description about what I am doing:
>>
>>        A UserStatusPanel that is always shown does *new Link("register")*
>> with:
>>        @Override
>>                public void onClick() {
>>                        throw new
>> RestartResponseAtInterceptPageException(UserRegistrationPage.class);
>>                }
>>
>>        When the user gets to the page, submmits its registration data and
>> the page sends an email with a link like:
>> http://localhost:8080/ua?ua=2baab43f784b5b530b5347a50490bb0a
>>
>>
>>        In my webApp, I've done:
>>        this.mount(new QueryStringUrlCodingStrategy("/ua",
>> UserActivationPage.class));
>>
>>        When the user goes to the previous mentioned link by a new tab, the
>> following happens:
>>
>>        _______________________
>>        GET /ua?ua=2e129db15b6d6db5342ba5d328642262 HTTP/1.1
>>        Host: localhost:8080
>>        ....
>>        Connection: keep-alive
>>        Cookie: JSESSIONID=78ehtk0o3y0w
>>        _______________________________
>>        === IN org.apache.wicket.RequestCycle.processEventsAndRespond() ===
>>        --processor.processEvents(this);
>>        ---- UserActivationPage is constructed, and the page activates the
>> user
>>        ---- UserActivationPage does: setResponsePage(LoginPage.class);
>>        --processor.respond(this);
>>        ----LoginPage is constructed (messages exists in session and are
>> properly rendered to somewhere)
>>        ===================================================================
>>        [I can see in firebug that the correct response reaches the browser!]
>>
>>        Strangely, In the page, wicket adds:        <script
>> type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
>> if (window.name=='' || (window.name.indexOf('wicket') > -1 &&
>> window.name!='wicket-wicket:default')) {
>> window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage"
>> + (window.location.hash != null ? window.location.hash : ""); }
>> /*-->]]>*/</script>
>>
>>        [So a new request is made!]
>>        ___________________________________________
>>        GET
>> /ua?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage
>> HTTP/1.1
>>        Host: localhost:8080
>>        ...
>>        Connection: keep-alive
>>        Referer: http://localhost:8080/ua?ua=2e129db15b6d6db5342ba5d328642262
>>        Cookie: JSESSIONID=78ehtk0o3y0w
>>        ________________________________________________
>>        === IN org.apache.wicket.RequestCycle.processEventsAndRespond() ===
>>        --processor.processEvents(this);
>>        ---- LoginPage is constructed (not UserActivationPage like it did
>> before) (this time, messages from the session are gonne)
>>        --processor.respond(this); finally this page is shown without my
>> messages :(
>>        ===================================================================
>>
>> Thanks in advance,
>>
>>
>> Esteban
>>
>>
>>
>>
>>
>>
>> Martin Grigorov escribió:
>>     
>>> El mar, 20-10-2009 a las 15:04 -0700, Douglas Ferguson escribió:
>>>
>>>       
>>>> You can also check your html to make sure there aren't any urls that
>>>>  would get loaded by the browser.
>>>>
>>>> i.e. <link>, <img>, etc tags..
>>>>
>>>>         
>>> yeah, <img src="" ... /> will make a second request to the page. quite
>>> nasty!
>>> fortunately there is a checker for these kind of problems in
>>> wicket-devutils project
>>>
>>>       
>>>> D/
>>>>
>>>>
>>>> On Oct 20, 2009, at 4:39 PM, Jeremy Thomerson wrote:
>>>>
>>>>
>>>>         
>>>>> Have you followed the suggestions in this thread?
>>>>>
>>>>> First, put a breakpoint to see what's instantiating the page - the  most
>>>>> likely suspect for an unintended additional instantiation is a bad
>>>>>  link,
>>>>> something like: new PageLink(new MyPage());   <--- shouldn't do that
>>>>>
>>>>> If it's Wicket code, what code is it?  Why?  It might be stateless as
>>>>> Martijn suggested.
>>>>>
>>>>> --
>>>>> Jeremy Thomerson
>>>>> http://www.wickettraining.com
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Oct 20, 2009 at 4:23 PM, Esteban Ignacio Masoero <
>>>>> emasoero@getsense.com.ar> wrote:
>>>>>
>>>>>
>>>>>           
>>>>>> Hi there. I'm bringing to life this old thread to ask whether this
>>>>>>  issue
>>>>>> was
>>>>>> solved and how, because I'm experiencing something alike, which makes
>>>>>> session messsages to get lost ("consummed" by the first instance of
>>>>>>  the
>>>>>> page), and consecuently not shown by the second page instance.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Esteban
>>>>>>
>>>>>>
>>>>>>
>>>>>> Vinayak Borkar wrote:
>>>>>>
>>>>>>             
>>>>>>> Martijn,
>>>>>>>
>>>>>>> Ok. I set the getStatelessHint() to return false.
>>>>>>>
>>>>>>> Now I get java.lang.IllegalStateException: No SessionHandler or
>>>>>>> SessionManager
>>>>>>>
>>>>>>> What is the reason that wicket needs to instantiate the page  twice? I
>>>>>>> can understand the second instantiation, but my guess is that the
>>>>>>>  first
>>>>>>> instantiation is not to render the HTML.
>>>>>>>
>>>>>>> If I am correct about my analysis above, is there some way I can  know
>>>>>>> that the instantiation does not need to populate all the components?
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Vinayak
>>>>>>>
>>>>>>> Martijn Dashorst wrote:
>>>>>>>
>>>>>>>               
>>>>>>>> Your page is stateless, which is a holy grail for most to attend.  Be
>>>>>>>> happy :)
>>>>>>>>
>>>>>>>> Since it is stateless, Wicket has to construct the page with each
>>>>>>>> request, until it is no longer stateless.
>>>>>>>>
>>>>>>>> If you have a form, override its getstatelesshint method and return
>>>>>>>> false.
>>>>>>>>
>>>>>>>> Martijn
>>>>>>>>
>>>>>>>> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com>
>>>>>>>>
>>>>>>>>                 
>>>>>> wrote:
>>>>>>
>>>>>>             
>>>>>>>>> Jeremy,
>>>>>>>>>
>>>>>>>>> I did that. The first time it is
>>>>>>>>>
>>>>>>>>> at
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents
>>>>>> (BookmarkableListenerInterfaceRequestTarget.java:127)
>>>>>>
>>>>>>             
>>>>>>>>> and the second time it is
>>>>>>>>>
>>>>>>>>> at
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents
>>>>>> (BookmarkablePageRequestTarget.java:223)
>>>>>>
>>>>>>             
>>>>>>>>> Does that help?
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Vinayak
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Jeremy Thomerson wrote:
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>>>> Run it in debug mode, put a breakpoint in your constructor and  see
>>>>>>>>>> what's
>>>>>>>>>> instantiating each.  A lot of times it is your own code (a bad
>>>>>>>>>>  link,
>>>>>>>>>> etc).
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Jeremy Thomerson
>>>>>>>>>> http://www.wickettraining.com
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar  <vb...@yahoo.com>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                     
>>>>>>>>>>> Hello,
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I have a form that performs a search and shows a page with
>>>>>>>>>>>  results.
>>>>>>>>>>> The
>>>>>>>>>>> result page also has the same form to do a repeat search. I
>>>>>>>>>>>  noticed
>>>>>>>>>>> that
>>>>>>>>>>> the
>>>>>>>>>>> SearchPage is instantiated twice when I do a search from the  form
>>>>>>>>>>> on
>>>>>>>>>>> the
>>>>>>>>>>> result page. Is there a way to make sure that does not happen?
>>>>>>>>>>>  The
>>>>>>>>>>> search
>>>>>>>>>>> page ends up doing the search twice.
>>>>>>>>>>>
>>>>>>>>>>> Thanks,
>>>>>>>>>>> Vinayak
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                       
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>>                 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/Page-instantiated-twice- tp22799162p25982806.html
>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Igor Vaynberg <ig...@gmail.com>.
are you opening the page in a new tab? this script is part of wicket
auto-multi-window support, it detects if the page has been opened in a
new tab and redirects to a url that will point to the same page but in
a new pagemap.

-igor

On Tue, Oct 20, 2009 at 4:23 PM, Esteban Masoero
<em...@getsense.com.ar> wrote:
>
> First of all, thanks to all of you for your help.
> I haven't solved the problem, but I'm getting closer to it.
> (something like: new PageLink(new MyPage()); <= I checked it and I'm not
> doing that. )
>
> Here's what I've found out:
>
> After debugging a lot, I find out that TWO REQUESTS are made. The first one
> as a consecuence of the user asking for that page, and the second one
> because in that page the following script is added at the end of <head> tag:
> <script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
> if (window.name=='' || (window.name.indexOf('wicket') > -1 &&
> window.name!='wicket-wicket:default')) {
> window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage"
> + (window.location.hash != null ? window.location.hash : ""); }
> /*-->]]>*/</script>
>
> Can anyone tell me why is Wicket doing that? or what am I doing wrong?
>
>
> |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> Here's the complete detailed description about what I am doing:
>
>        A UserStatusPanel that is always shown does *new Link("register")*
> with:
>        @Override
>                public void onClick() {
>                        throw new
> RestartResponseAtInterceptPageException(UserRegistrationPage.class);
>                }
>
>        When the user gets to the page, submmits its registration data and
> the page sends an email with a link like:
> http://localhost:8080/ua?ua=2baab43f784b5b530b5347a50490bb0a
>
>
>        In my webApp, I've done:
>        this.mount(new QueryStringUrlCodingStrategy("/ua",
> UserActivationPage.class));
>
>        When the user goes to the previous mentioned link by a new tab, the
> following happens:
>
>        _______________________
>        GET /ua?ua=2e129db15b6d6db5342ba5d328642262 HTTP/1.1
>        Host: localhost:8080
>        ....
>        Connection: keep-alive
>        Cookie: JSESSIONID=78ehtk0o3y0w
>        _______________________________
>        === IN org.apache.wicket.RequestCycle.processEventsAndRespond() ===
>        --processor.processEvents(this);
>        ---- UserActivationPage is constructed, and the page activates the
> user
>        ---- UserActivationPage does: setResponsePage(LoginPage.class);
>        --processor.respond(this);
>        ----LoginPage is constructed (messages exists in session and are
> properly rendered to somewhere)
>        ===================================================================
>        [I can see in firebug that the correct response reaches the browser!]
>
>        Strangely, In the page, wicket adds:        <script
> type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
> if (window.name=='' || (window.name.indexOf('wicket') > -1 &&
> window.name!='wicket-wicket:default')) {
> window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage"
> + (window.location.hash != null ? window.location.hash : ""); }
> /*-->]]>*/</script>
>
>        [So a new request is made!]
>        ___________________________________________
>        GET
> /ua?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage
> HTTP/1.1
>        Host: localhost:8080
>        ...
>        Connection: keep-alive
>        Referer: http://localhost:8080/ua?ua=2e129db15b6d6db5342ba5d328642262
>        Cookie: JSESSIONID=78ehtk0o3y0w
>        ________________________________________________
>        === IN org.apache.wicket.RequestCycle.processEventsAndRespond() ===
>        --processor.processEvents(this);
>        ---- LoginPage is constructed (not UserActivationPage like it did
> before) (this time, messages from the session are gonne)
>        --processor.respond(this); finally this page is shown without my
> messages :(
>        ===================================================================
>
> Thanks in advance,
>
>
> Esteban
>
>
>
>
>
>
> Martin Grigorov escribió:
>>
>> El mar, 20-10-2009 a las 15:04 -0700, Douglas Ferguson escribió:
>>
>>>
>>> You can also check your html to make sure there aren't any urls that
>>>  would get loaded by the browser.
>>>
>>> i.e. <link>, <img>, etc tags..
>>>
>>
>> yeah, <img src="" ... /> will make a second request to the page. quite
>> nasty!
>> fortunately there is a checker for these kind of problems in
>> wicket-devutils project
>>
>>>
>>> D/
>>>
>>>
>>> On Oct 20, 2009, at 4:39 PM, Jeremy Thomerson wrote:
>>>
>>>
>>>>
>>>> Have you followed the suggestions in this thread?
>>>>
>>>> First, put a breakpoint to see what's instantiating the page - the  most
>>>> likely suspect for an unintended additional instantiation is a bad
>>>>  link,
>>>> something like: new PageLink(new MyPage());   <--- shouldn't do that
>>>>
>>>> If it's Wicket code, what code is it?  Why?  It might be stateless as
>>>> Martijn suggested.
>>>>
>>>> --
>>>> Jeremy Thomerson
>>>> http://www.wickettraining.com
>>>>
>>>>
>>>>
>>>> On Tue, Oct 20, 2009 at 4:23 PM, Esteban Ignacio Masoero <
>>>> emasoero@getsense.com.ar> wrote:
>>>>
>>>>
>>>>>
>>>>> Hi there. I'm bringing to life this old thread to ask whether this
>>>>>  issue
>>>>> was
>>>>> solved and how, because I'm experiencing something alike, which makes
>>>>> session messsages to get lost ("consummed" by the first instance of
>>>>>  the
>>>>> page), and consecuently not shown by the second page instance.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Esteban
>>>>>
>>>>>
>>>>>
>>>>> Vinayak Borkar wrote:
>>>>>
>>>>>>
>>>>>> Martijn,
>>>>>>
>>>>>> Ok. I set the getStatelessHint() to return false.
>>>>>>
>>>>>> Now I get java.lang.IllegalStateException: No SessionHandler or
>>>>>> SessionManager
>>>>>>
>>>>>> What is the reason that wicket needs to instantiate the page  twice? I
>>>>>> can understand the second instantiation, but my guess is that the
>>>>>>  first
>>>>>> instantiation is not to render the HTML.
>>>>>>
>>>>>> If I am correct about my analysis above, is there some way I can  know
>>>>>> that the instantiation does not need to populate all the components?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Vinayak
>>>>>>
>>>>>> Martijn Dashorst wrote:
>>>>>>
>>>>>>>
>>>>>>> Your page is stateless, which is a holy grail for most to attend.  Be
>>>>>>> happy :)
>>>>>>>
>>>>>>> Since it is stateless, Wicket has to construct the page with each
>>>>>>> request, until it is no longer stateless.
>>>>>>>
>>>>>>> If you have a form, override its getstatelesshint method and return
>>>>>>> false.
>>>>>>>
>>>>>>> Martijn
>>>>>>>
>>>>>>> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com>
>>>>>>>
>>>>>
>>>>> wrote:
>>>>>
>>>>>>>>
>>>>>>>> Jeremy,
>>>>>>>>
>>>>>>>> I did that. The first time it is
>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>
>>>>>
>>>>> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents
>>>>> (BookmarkableListenerInterfaceRequestTarget.java:127)
>>>>>
>>>>>>>>
>>>>>>>> and the second time it is
>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>
>>>>>
>>>>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents
>>>>> (BookmarkablePageRequestTarget.java:223)
>>>>>
>>>>>>>>
>>>>>>>> Does that help?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Vinayak
>>>>>>>>
>>>>>>>>
>>>>>>>> Jeremy Thomerson wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Run it in debug mode, put a breakpoint in your constructor and  see
>>>>>>>>> what's
>>>>>>>>> instantiating each.  A lot of times it is your own code (a bad
>>>>>>>>>  link,
>>>>>>>>> etc).
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Jeremy Thomerson
>>>>>>>>> http://www.wickettraining.com
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar  <vb...@yahoo.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I have a form that performs a search and shows a page with
>>>>>>>>>>  results.
>>>>>>>>>> The
>>>>>>>>>> result page also has the same form to do a repeat search. I
>>>>>>>>>>  noticed
>>>>>>>>>> that
>>>>>>>>>> the
>>>>>>>>>> SearchPage is instantiated twice when I do a search from the  form
>>>>>>>>>> on
>>>>>>>>>> the
>>>>>>>>>> result page. Is there a way to make sure that does not happen?
>>>>>>>>>>  The
>>>>>>>>>> search
>>>>>>>>>> page ends up doing the search twice.
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> Vinayak
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Page-instantiated-twice- tp22799162p25982806.html
>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Esteban Masoero <em...@getsense.com.ar>.
First of all, thanks to all of you for your help.
I haven't solved the problem, but I'm getting closer to it.
(something like: new PageLink(new MyPage()); <= I checked it and I'm not 
doing that. )

Here's what I've found out:

After debugging a lot, I find out that TWO REQUESTS are made. The first one as a consecuence of the user asking for that page, and the second one because in that page the following script is added at the end of <head> tag:
<script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
if (window.name=='' || (window.name.indexOf('wicket') > -1 && window.name!='wicket-wicket:default')) { window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage" + (window.location.hash != null ? window.location.hash : ""); }
/*-->]]>*/</script>

Can anyone tell me why is Wicket doing that? or what am I doing wrong?


|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Here's the complete detailed description about what I am doing:

	A UserStatusPanel that is always shown does *new Link("register")* with:
	@Override
		public void onClick() {
			throw new RestartResponseAtInterceptPageException(UserRegistrationPage.class);
		}
		
	When the user gets to the page, submmits its registration data and the page sends an email with a link like: http://localhost:8080/ua?ua=2baab43f784b5b530b5347a50490bb0a
	
	
	In my webApp, I've done:
	this.mount(new QueryStringUrlCodingStrategy("/ua", UserActivationPage.class));
	
	When the user goes to the previous mentioned link by a new tab, the following happens:
	
	_______________________
	GET /ua?ua=2e129db15b6d6db5342ba5d328642262 HTTP/1.1
	Host: localhost:8080
	....
	Connection: keep-alive
	Cookie: JSESSIONID=78ehtk0o3y0w
	_______________________________
	=== IN org.apache.wicket.RequestCycle.processEventsAndRespond() ===
	--processor.processEvents(this);
	---- UserActivationPage is constructed, and the page activates the user
	---- UserActivationPage does: setResponsePage(LoginPage.class);
	--processor.respond(this);
	----LoginPage is constructed (messages exists in session and are properly rendered to somewhere)
	===================================================================
	[I can see in firebug that the correct response reaches the browser!]
	
	Strangely, In the page, wicket adds: 
	<script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
if (window.name=='' || (window.name.indexOf('wicket') > -1 && window.name!='wicket-wicket:default')) { window.location="?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage" + (window.location.hash != null ? window.location.hash : ""); }
/*-->]]>*/</script>
	
	[So a new request is made!]
	___________________________________________
	GET /ua?wicket:bookmarkablePage=wicket-6:ar.com.getsense.latamvalley.pages.LoginPage HTTP/1.1
	Host: localhost:8080
	...
	Connection: keep-alive
	Referer: http://localhost:8080/ua?ua=2e129db15b6d6db5342ba5d328642262
	Cookie: JSESSIONID=78ehtk0o3y0w
	________________________________________________
	=== IN org.apache.wicket.RequestCycle.processEventsAndRespond() ===
	--processor.processEvents(this);
	---- LoginPage is constructed (not UserActivationPage like it did before) (this time, messages from the session are gonne)
	--processor.respond(this); finally this page is shown without my messages :(
	===================================================================

Thanks in advance,


Esteban
	





Martin Grigorov escribió:
> El mar, 20-10-2009 a las 15:04 -0700, Douglas Ferguson escribió:
>   
>> You can also check your html to make sure there aren't any urls that  
>> would get loaded by the browser.
>>
>> i.e. <link>, <img>, etc tags..
>>     
> yeah, <img src="" ... /> will make a second request to the page. 
> quite nasty!
> fortunately there is a checker for these kind of problems in
> wicket-devutils project
>   
>> D/
>>
>>
>> On Oct 20, 2009, at 4:39 PM, Jeremy Thomerson wrote:
>>
>>     
>>> Have you followed the suggestions in this thread?
>>>
>>> First, put a breakpoint to see what's instantiating the page - the  
>>> most
>>> likely suspect for an unintended additional instantiation is a bad  
>>> link,
>>> something like: new PageLink(new MyPage());   <--- shouldn't do that
>>>
>>> If it's Wicket code, what code is it?  Why?  It might be stateless as
>>> Martijn suggested.
>>>
>>> --
>>> Jeremy Thomerson
>>> http://www.wickettraining.com
>>>
>>>
>>>
>>> On Tue, Oct 20, 2009 at 4:23 PM, Esteban Ignacio Masoero <
>>> emasoero@getsense.com.ar> wrote:
>>>
>>>       
>>>> Hi there. I'm bringing to life this old thread to ask whether this  
>>>> issue
>>>> was
>>>> solved and how, because I'm experiencing something alike, which makes
>>>> session messsages to get lost ("consummed" by the first instance of  
>>>> the
>>>> page), and consecuently not shown by the second page instance.
>>>>
>>>> Thanks,
>>>>
>>>> Esteban
>>>>
>>>>
>>>>
>>>> Vinayak Borkar wrote:
>>>>         
>>>>> Martijn,
>>>>>
>>>>> Ok. I set the getStatelessHint() to return false.
>>>>>
>>>>> Now I get java.lang.IllegalStateException: No SessionHandler or
>>>>> SessionManager
>>>>>
>>>>> What is the reason that wicket needs to instantiate the page  
>>>>> twice? I
>>>>> can understand the second instantiation, but my guess is that the  
>>>>> first
>>>>> instantiation is not to render the HTML.
>>>>>
>>>>> If I am correct about my analysis above, is there some way I can  
>>>>> know
>>>>> that the instantiation does not need to populate all the components?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Vinayak
>>>>>
>>>>> Martijn Dashorst wrote:
>>>>>           
>>>>>> Your page is stateless, which is a holy grail for most to attend.  
>>>>>> Be
>>>>>> happy :)
>>>>>>
>>>>>> Since it is stateless, Wicket has to construct the page with each
>>>>>> request, until it is no longer stateless.
>>>>>>
>>>>>> If you have a form, override its getstatelesshint method and return
>>>>>> false.
>>>>>>
>>>>>> Martijn
>>>>>>
>>>>>> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com>
>>>>>>             
>>>> wrote:
>>>>         
>>>>>>> Jeremy,
>>>>>>>
>>>>>>> I did that. The first time it is
>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>               
>>>> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents 
>>>> (BookmarkableListenerInterfaceRequestTarget.java:127)
>>>>         
>>>>>>> and the second time it is
>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>               
>>>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents 
>>>> (BookmarkablePageRequestTarget.java:223)
>>>>         
>>>>>>> Does that help?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Vinayak
>>>>>>>
>>>>>>>
>>>>>>> Jeremy Thomerson wrote:
>>>>>>>               
>>>>>>>> Run it in debug mode, put a breakpoint in your constructor and  
>>>>>>>> see
>>>>>>>> what's
>>>>>>>> instantiating each.  A lot of times it is your own code (a bad  
>>>>>>>> link,
>>>>>>>> etc).
>>>>>>>>
>>>>>>>> --
>>>>>>>> Jeremy Thomerson
>>>>>>>> http://www.wickettraining.com
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar  
>>>>>>>> <vb...@yahoo.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I have a form that performs a search and shows a page with  
>>>>>>>>> results.
>>>>>>>>> The
>>>>>>>>> result page also has the same form to do a repeat search. I  
>>>>>>>>> noticed
>>>>>>>>> that
>>>>>>>>> the
>>>>>>>>> SearchPage is instantiated twice when I do a search from the  
>>>>>>>>> form on
>>>>>>>>> the
>>>>>>>>> result page. Is there a way to make sure that does not happen?  
>>>>>>>>> The
>>>>>>>>> search
>>>>>>>>> page ends up doing the search twice.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Vinayak
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Page-instantiated-twice- 
>>>> tp22799162p25982806.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>         
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Martin Grigorov <mc...@e-card.bg>.
El mar, 20-10-2009 a las 15:04 -0700, Douglas Ferguson escribió:
> You can also check your html to make sure there aren't any urls that  
> would get loaded by the browser.
> 
> i.e. <link>, <img>, etc tags..
yeah, <img src="" ... /> will make a second request to the page. 
quite nasty!
fortunately there is a checker for these kind of problems in
wicket-devutils project
> 
> D/
> 
> 
> On Oct 20, 2009, at 4:39 PM, Jeremy Thomerson wrote:
> 
> > Have you followed the suggestions in this thread?
> >
> > First, put a breakpoint to see what's instantiating the page - the  
> > most
> > likely suspect for an unintended additional instantiation is a bad  
> > link,
> > something like: new PageLink(new MyPage());   <--- shouldn't do that
> >
> > If it's Wicket code, what code is it?  Why?  It might be stateless as
> > Martijn suggested.
> >
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
> >
> >
> > On Tue, Oct 20, 2009 at 4:23 PM, Esteban Ignacio Masoero <
> > emasoero@getsense.com.ar> wrote:
> >
> >>
> >> Hi there. I'm bringing to life this old thread to ask whether this  
> >> issue
> >> was
> >> solved and how, because I'm experiencing something alike, which makes
> >> session messsages to get lost ("consummed" by the first instance of  
> >> the
> >> page), and consecuently not shown by the second page instance.
> >>
> >> Thanks,
> >>
> >> Esteban
> >>
> >>
> >>
> >> Vinayak Borkar wrote:
> >>>
> >>> Martijn,
> >>>
> >>> Ok. I set the getStatelessHint() to return false.
> >>>
> >>> Now I get java.lang.IllegalStateException: No SessionHandler or
> >>> SessionManager
> >>>
> >>> What is the reason that wicket needs to instantiate the page  
> >>> twice? I
> >>> can understand the second instantiation, but my guess is that the  
> >>> first
> >>> instantiation is not to render the HTML.
> >>>
> >>> If I am correct about my analysis above, is there some way I can  
> >>> know
> >>> that the instantiation does not need to populate all the components?
> >>>
> >>> Thanks,
> >>>
> >>> Vinayak
> >>>
> >>> Martijn Dashorst wrote:
> >>>> Your page is stateless, which is a holy grail for most to attend.  
> >>>> Be
> >>>> happy :)
> >>>>
> >>>> Since it is stateless, Wicket has to construct the page with each
> >>>> request, until it is no longer stateless.
> >>>>
> >>>> If you have a form, override its getstatelesshint method and return
> >>>> false.
> >>>>
> >>>> Martijn
> >>>>
> >>>> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com>
> >> wrote:
> >>>>> Jeremy,
> >>>>>
> >>>>> I did that. The first time it is
> >>>>>
> >>>>> at
> >>>>>
> >> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents 
> >> (BookmarkableListenerInterfaceRequestTarget.java:127)
> >>>>>
> >>>>> and the second time it is
> >>>>>
> >>>>> at
> >>>>>
> >> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents 
> >> (BookmarkablePageRequestTarget.java:223)
> >>>>>
> >>>>>
> >>>>> Does that help?
> >>>>>
> >>>>> Thanks,
> >>>>> Vinayak
> >>>>>
> >>>>>
> >>>>> Jeremy Thomerson wrote:
> >>>>>> Run it in debug mode, put a breakpoint in your constructor and  
> >>>>>> see
> >>>>>> what's
> >>>>>> instantiating each.  A lot of times it is your own code (a bad  
> >>>>>> link,
> >>>>>> etc).
> >>>>>>
> >>>>>> --
> >>>>>> Jeremy Thomerson
> >>>>>> http://www.wickettraining.com
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar  
> >>>>>> <vb...@yahoo.com>
> >>>>>> wrote:
> >>>>>>
> >>>>>>> Hello,
> >>>>>>>
> >>>>>>>
> >>>>>>> I have a form that performs a search and shows a page with  
> >>>>>>> results.
> >>>>>>> The
> >>>>>>> result page also has the same form to do a repeat search. I  
> >>>>>>> noticed
> >>>>>>> that
> >>>>>>> the
> >>>>>>> SearchPage is instantiated twice when I do a search from the  
> >>>>>>> form on
> >>>>>>> the
> >>>>>>> result page. Is there a way to make sure that does not happen?  
> >>>>>>> The
> >>>>>>> search
> >>>>>>> page ends up doing the search twice.
> >>>>>>>
> >>>>>>> Thanks,
> >>>>>>> Vinayak
> >>>>>>>
> >>>>>>> ---------------------------------------------------------------------
> >>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Page-instantiated-twice- 
> >> tp22799162p25982806.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Douglas Ferguson <do...@douglasferguson.us>.
You can also check your html to make sure there aren't any urls that  
would get loaded by the browser.

i.e. <link>, <img>, etc tags..

D/


On Oct 20, 2009, at 4:39 PM, Jeremy Thomerson wrote:

> Have you followed the suggestions in this thread?
>
> First, put a breakpoint to see what's instantiating the page - the  
> most
> likely suspect for an unintended additional instantiation is a bad  
> link,
> something like: new PageLink(new MyPage());   <--- shouldn't do that
>
> If it's Wicket code, what code is it?  Why?  It might be stateless as
> Martijn suggested.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Tue, Oct 20, 2009 at 4:23 PM, Esteban Ignacio Masoero <
> emasoero@getsense.com.ar> wrote:
>
>>
>> Hi there. I'm bringing to life this old thread to ask whether this  
>> issue
>> was
>> solved and how, because I'm experiencing something alike, which makes
>> session messsages to get lost ("consummed" by the first instance of  
>> the
>> page), and consecuently not shown by the second page instance.
>>
>> Thanks,
>>
>> Esteban
>>
>>
>>
>> Vinayak Borkar wrote:
>>>
>>> Martijn,
>>>
>>> Ok. I set the getStatelessHint() to return false.
>>>
>>> Now I get java.lang.IllegalStateException: No SessionHandler or
>>> SessionManager
>>>
>>> What is the reason that wicket needs to instantiate the page  
>>> twice? I
>>> can understand the second instantiation, but my guess is that the  
>>> first
>>> instantiation is not to render the HTML.
>>>
>>> If I am correct about my analysis above, is there some way I can  
>>> know
>>> that the instantiation does not need to populate all the components?
>>>
>>> Thanks,
>>>
>>> Vinayak
>>>
>>> Martijn Dashorst wrote:
>>>> Your page is stateless, which is a holy grail for most to attend.  
>>>> Be
>>>> happy :)
>>>>
>>>> Since it is stateless, Wicket has to construct the page with each
>>>> request, until it is no longer stateless.
>>>>
>>>> If you have a form, override its getstatelesshint method and return
>>>> false.
>>>>
>>>> Martijn
>>>>
>>>> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com>
>> wrote:
>>>>> Jeremy,
>>>>>
>>>>> I did that. The first time it is
>>>>>
>>>>> at
>>>>>
>> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents 
>> (BookmarkableListenerInterfaceRequestTarget.java:127)
>>>>>
>>>>> and the second time it is
>>>>>
>>>>> at
>>>>>
>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents 
>> (BookmarkablePageRequestTarget.java:223)
>>>>>
>>>>>
>>>>> Does that help?
>>>>>
>>>>> Thanks,
>>>>> Vinayak
>>>>>
>>>>>
>>>>> Jeremy Thomerson wrote:
>>>>>> Run it in debug mode, put a breakpoint in your constructor and  
>>>>>> see
>>>>>> what's
>>>>>> instantiating each.  A lot of times it is your own code (a bad  
>>>>>> link,
>>>>>> etc).
>>>>>>
>>>>>> --
>>>>>> Jeremy Thomerson
>>>>>> http://www.wickettraining.com
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar  
>>>>>> <vb...@yahoo.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>>
>>>>>>> I have a form that performs a search and shows a page with  
>>>>>>> results.
>>>>>>> The
>>>>>>> result page also has the same form to do a repeat search. I  
>>>>>>> noticed
>>>>>>> that
>>>>>>> the
>>>>>>> SearchPage is instantiated twice when I do a search from the  
>>>>>>> form on
>>>>>>> the
>>>>>>> result page. Is there a way to make sure that does not happen?  
>>>>>>> The
>>>>>>> search
>>>>>>> page ends up doing the search twice.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Vinayak
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Page-instantiated-twice- 
>> tp22799162p25982806.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Have you followed the suggestions in this thread?

First, put a breakpoint to see what's instantiating the page - the most
likely suspect for an unintended additional instantiation is a bad link,
something like: new PageLink(new MyPage());   <--- shouldn't do that

If it's Wicket code, what code is it?  Why?  It might be stateless as
Martijn suggested.

--
Jeremy Thomerson
http://www.wickettraining.com



On Tue, Oct 20, 2009 at 4:23 PM, Esteban Ignacio Masoero <
emasoero@getsense.com.ar> wrote:

>
> Hi there. I'm bringing to life this old thread to ask whether this issue
> was
> solved and how, because I'm experiencing something alike, which makes
> session messsages to get lost ("consummed" by the first instance of the
> page), and consecuently not shown by the second page instance.
>
> Thanks,
>
> Esteban
>
>
>
> Vinayak Borkar wrote:
> >
> > Martijn,
> >
> > Ok. I set the getStatelessHint() to return false.
> >
> > Now I get java.lang.IllegalStateException: No SessionHandler or
> > SessionManager
> >
> > What is the reason that wicket needs to instantiate the page twice? I
> > can understand the second instantiation, but my guess is that the first
> > instantiation is not to render the HTML.
> >
> > If I am correct about my analysis above, is there some way I can know
> > that the instantiation does not need to populate all the components?
> >
> > Thanks,
> >
> > Vinayak
> >
> > Martijn Dashorst wrote:
> >> Your page is stateless, which is a holy grail for most to attend. Be
> >> happy :)
> >>
> >> Since it is stateless, Wicket has to construct the page with each
> >> request, until it is no longer stateless.
> >>
> >> If you have a form, override its getstatelesshint method and return
> >> false.
> >>
> >> Martijn
> >>
> >> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com>
> wrote:
> >>> Jeremy,
> >>>
> >>> I did that. The first time it is
> >>>
> >>> at
> >>>
> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents(BookmarkableListenerInterfaceRequestTarget.java:127)
> >>>
> >>> and the second time it is
> >>>
> >>> at
> >>>
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:223)
> >>>
> >>>
> >>> Does that help?
> >>>
> >>> Thanks,
> >>> Vinayak
> >>>
> >>>
> >>> Jeremy Thomerson wrote:
> >>>> Run it in debug mode, put a breakpoint in your constructor and see
> >>>> what's
> >>>> instantiating each.  A lot of times it is your own code (a bad link,
> >>>> etc).
> >>>>
> >>>> --
> >>>> Jeremy Thomerson
> >>>> http://www.wickettraining.com
> >>>>
> >>>>
> >>>>
> >>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar <vb...@yahoo.com>
> >>>> wrote:
> >>>>
> >>>>> Hello,
> >>>>>
> >>>>>
> >>>>> I have a form that performs a search and shows a page with results.
> >>>>> The
> >>>>> result page also has the same form to do a repeat search. I noticed
> >>>>> that
> >>>>> the
> >>>>> SearchPage is instantiated twice when I do a search from the form on
> >>>>> the
> >>>>> result page. Is there a way to make sure that does not happen? The
> >>>>> search
> >>>>> page ends up doing the search twice.
> >>>>>
> >>>>> Thanks,
> >>>>> Vinayak
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>
> >>>>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Page-instantiated-twice-tp22799162p25982806.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Page instantiated twice

Posted by Esteban Ignacio Masoero <em...@getsense.com.ar>.
Hi there. I'm bringing to life this old thread to ask whether this issue was
solved and how, because I'm experiencing something alike, which makes
session messsages to get lost ("consummed" by the first instance of the
page), and consecuently not shown by the second page instance.

Thanks,

Esteban



Vinayak Borkar wrote:
> 
> Martijn,
> 
> Ok. I set the getStatelessHint() to return false.
> 
> Now I get java.lang.IllegalStateException: No SessionHandler or 
> SessionManager
> 
> What is the reason that wicket needs to instantiate the page twice? I 
> can understand the second instantiation, but my guess is that the first 
> instantiation is not to render the HTML.
> 
> If I am correct about my analysis above, is there some way I can know 
> that the instantiation does not need to populate all the components?
> 
> Thanks,
> 
> Vinayak
> 
> Martijn Dashorst wrote:
>> Your page is stateless, which is a holy grail for most to attend. Be
>> happy :)
>> 
>> Since it is stateless, Wicket has to construct the page with each
>> request, until it is no longer stateless.
>> 
>> If you have a form, override its getstatelesshint method and return
>> false.
>> 
>> Martijn
>> 
>> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com> wrote:
>>> Jeremy,
>>>
>>> I did that. The first time it is
>>>
>>> at
>>> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents(BookmarkableListenerInterfaceRequestTarget.java:127)
>>>
>>> and the second time it is
>>>
>>> at
>>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:223)
>>>
>>>
>>> Does that help?
>>>
>>> Thanks,
>>> Vinayak
>>>
>>>
>>> Jeremy Thomerson wrote:
>>>> Run it in debug mode, put a breakpoint in your constructor and see
>>>> what's
>>>> instantiating each.  A lot of times it is your own code (a bad link,
>>>> etc).
>>>>
>>>> --
>>>> Jeremy Thomerson
>>>> http://www.wickettraining.com
>>>>
>>>>
>>>>
>>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar <vb...@yahoo.com>
>>>> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>>
>>>>> I have a form that performs a search and shows a page with results.
>>>>> The
>>>>> result page also has the same form to do a repeat search. I noticed
>>>>> that
>>>>> the
>>>>> SearchPage is instantiated twice when I do a search from the form on
>>>>> the
>>>>> result page. Is there a way to make sure that does not happen? The
>>>>> search
>>>>> page ends up doing the search twice.
>>>>>
>>>>> Thanks,
>>>>> Vinayak
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>> 
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Page-instantiated-twice-tp22799162p25982806.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Vinayak Borkar <vb...@yahoo.com>.
Martijn,

Ok. I set the getStatelessHint() to return false.

Now I get java.lang.IllegalStateException: No SessionHandler or 
SessionManager

What is the reason that wicket needs to instantiate the page twice? I 
can understand the second instantiation, but my guess is that the first 
instantiation is not to render the HTML.

If I am correct about my analysis above, is there some way I can know 
that the instantiation does not need to populate all the components?

Thanks,

Vinayak

Martijn Dashorst wrote:
> Your page is stateless, which is a holy grail for most to attend. Be happy :)
> 
> Since it is stateless, Wicket has to construct the page with each
> request, until it is no longer stateless.
> 
> If you have a form, override its getstatelesshint method and return false.
> 
> Martijn
> 
> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com> wrote:
>> Jeremy,
>>
>> I did that. The first time it is
>>
>> at
>> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents(BookmarkableListenerInterfaceRequestTarget.java:127)
>>
>> and the second time it is
>>
>> at
>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:223)
>>
>>
>> Does that help?
>>
>> Thanks,
>> Vinayak
>>
>>
>> Jeremy Thomerson wrote:
>>> Run it in debug mode, put a breakpoint in your constructor and see what's
>>> instantiating each.  A lot of times it is your own code (a bad link, etc).
>>>
>>> --
>>> Jeremy Thomerson
>>> http://www.wickettraining.com
>>>
>>>
>>>
>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar <vb...@yahoo.com> wrote:
>>>
>>>> Hello,
>>>>
>>>>
>>>> I have a form that performs a search and shows a page with results. The
>>>> result page also has the same form to do a repeat search. I noticed that
>>>> the
>>>> SearchPage is instantiated twice when I do a search from the form on the
>>>> result page. Is there a way to make sure that does not happen? The search
>>>> page ends up doing the search twice.
>>>>
>>>> Thanks,
>>>> Vinayak
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Vinayak Borkar <vb...@yahoo.com>.
Martijn,

Does setting the statelessHint to false indicate that the form is stateful?

In that case, would Wicket try to serialize the form?

Thanks,
Vinayak

Martijn Dashorst wrote:
> Your page is stateless, which is a holy grail for most to attend. Be happy :)
> 
> Since it is stateless, Wicket has to construct the page with each
> request, until it is no longer stateless.
> 
> If you have a form, override its getstatelesshint method and return false.
> 
> Martijn
> 
> On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com> wrote:
>> Jeremy,
>>
>> I did that. The first time it is
>>
>> at
>> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents(BookmarkableListenerInterfaceRequestTarget.java:127)
>>
>> and the second time it is
>>
>> at
>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:223)
>>
>>
>> Does that help?
>>
>> Thanks,
>> Vinayak
>>
>>
>> Jeremy Thomerson wrote:
>>> Run it in debug mode, put a breakpoint in your constructor and see what's
>>> instantiating each.  A lot of times it is your own code (a bad link, etc).
>>>
>>> --
>>> Jeremy Thomerson
>>> http://www.wickettraining.com
>>>
>>>
>>>
>>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar <vb...@yahoo.com> wrote:
>>>
>>>> Hello,
>>>>
>>>>
>>>> I have a form that performs a search and shows a page with results. The
>>>> result page also has the same form to do a repeat search. I noticed that
>>>> the
>>>> SearchPage is instantiated twice when I do a search from the form on the
>>>> result page. Is there a way to make sure that does not happen? The search
>>>> page ends up doing the search twice.
>>>>
>>>> Thanks,
>>>> Vinayak
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Martijn Dashorst <ma...@gmail.com>.
Your page is stateless, which is a holy grail for most to attend. Be happy :)

Since it is stateless, Wicket has to construct the page with each
request, until it is no longer stateless.

If you have a form, override its getstatelesshint method and return false.

Martijn

On Tue, Mar 31, 2009 at 8:36 AM, Vinayak Borkar <vb...@yahoo.com> wrote:
> Jeremy,
>
> I did that. The first time it is
>
> at
> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents(BookmarkableListenerInterfaceRequestTarget.java:127)
>
> and the second time it is
>
> at
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:223)
>
>
> Does that help?
>
> Thanks,
> Vinayak
>
>
> Jeremy Thomerson wrote:
>>
>> Run it in debug mode, put a breakpoint in your constructor and see what's
>> instantiating each.  A lot of times it is your own code (a bad link, etc).
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar <vb...@yahoo.com> wrote:
>>
>>> Hello,
>>>
>>>
>>> I have a form that performs a search and shows a page with results. The
>>> result page also has the same form to do a repeat search. I noticed that
>>> the
>>> SearchPage is instantiated twice when I do a search from the form on the
>>> result page. Is there a way to make sure that does not happen? The search
>>> page ends up doing the search twice.
>>>
>>> Thanks,
>>> Vinayak
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Vinayak Borkar <vb...@yahoo.com>.
Jeremy,

I did that. The first time it is

at 
org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents(BookmarkableListenerInterfaceRequestTarget.java:127)

and the second time it is

at 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:223)


Does that help?

Thanks,
Vinayak


Jeremy Thomerson wrote:
> Run it in debug mode, put a breakpoint in your constructor and see what's
> instantiating each.  A lot of times it is your own code (a bad link, etc).
> 
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> 
> On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar <vb...@yahoo.com> wrote:
> 
>> Hello,
>>
>>
>> I have a form that performs a search and shows a page with results. The
>> result page also has the same form to do a repeat search. I noticed that the
>> SearchPage is instantiated twice when I do a search from the form on the
>> result page. Is there a way to make sure that does not happen? The search
>> page ends up doing the search twice.
>>
>> Thanks,
>> Vinayak
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page instantiated twice

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Run it in debug mode, put a breakpoint in your constructor and see what's
instantiating each.  A lot of times it is your own code (a bad link, etc).

--
Jeremy Thomerson
http://www.wickettraining.com



On Tue, Mar 31, 2009 at 1:30 AM, Vinayak Borkar <vb...@yahoo.com> wrote:

> Hello,
>
>
> I have a form that performs a search and shows a page with results. The
> result page also has the same form to do a repeat search. I noticed that the
> SearchPage is instantiated twice when I do a search from the form on the
> result page. Is there a way to make sure that does not happen? The search
> page ends up doing the search twice.
>
> Thanks,
> Vinayak
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>