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 <
emaso...@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 <vbo...@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 <vbo...@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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


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



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


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




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



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

Reply via email to