Hello Nick and Martin,

Thank you for your replies.

I have added the following code in my subclassed WebApplication#init()
method, to be called when my application's RuntimeConfigurationType is
RuntimeConfigurationType.DEVELOPMENT:


I find no resultant


entry in my logs (created by EmptySrcAttributeCheckFilter). Thanks for
pointing out EmptySrcAttributeCheckFilter; I never knew it existed, and I
use it in development mode from now on. I have also searched my HTML for
empty src attributes, but I can find none.

I believe that I have found the reason for my subclassed WebPage constructor
being called twice. Whilst returning from the exernal web site, my browser
shows the dialog



It is my clicking of the "Continue" button which causes the 2nd call to the
WebPage constructor. The 1st call is already made when the dialog appears.

Thank you again for your help and tip, and have a good day,

Ian



Martin Grigorov-4 wrote
> 
> Right,    can lead to such behavior.
> Newer versions of Wicket (1.5+) have a preconfigured IResponseFilter
> which notifies you about such problem in DEV mode.
> You can also use CSS like: a[src = ""] {color:red;} to see them easily.
> 
> No matter what is the configured render strategy Wicket will call the
> page's constructor just once.
> _to_buffer strategy renders the page in the first request and save the
> html in a temporary place and just writes the plain html in the second
> request's response.
> 
> 
> On Mon, Jun 25, 2012 at 9:53 PM, Nick Heudecker <nheudecker@> wrote:
>> I've only seen this type of behavior if I have an empty   
>> element or something similar.
>>
>>
>>
>> On Mon, Jun 25, 2012 at 11:45 AM, Ian Marshall
>> <IanMarshall.UK@>wrote:
>>
>>> Hello All,
>>>
>>> My web application uses the default request cycle render strategy
>>> IRequestCycleSettings.RenderStrategy.REDIRECT_TO_BUFFER.
>>>
>>> An external web site calls a web page on my web application using a URL
>>> with
>>> page parameters (all of which I set before I hand over to the external
>>> web
>>> site). I find that the relevant WebPage constructor gets called twice
>>> during
>>> the request-response process, which I presume is expected behaviour:
>>> once
>>> to
>>> handle the action part of the request, again to handle the render part
>>> of
>>> the request.
>>>
>>> In the past, I bypassed this issue by showing an option with an "OK"
>>> button
>>> for action, so it didn't matter if the page constructor was called
>>> twice;
>>> no
>>> persistence code got executed until the user clicked "OK" subsequently.
>>>
>>> Now, however, I need to act on the request from the external web site
>>> straight away, in order to ensure that the database is updated before
>>> the
>>> user moves to another page without clicking "OK" (or away from my
>>> application altogether). Currently, I code this to happen in the page's
>>> constructor, so my database persistence code get called twice too. Not
>>> good,
>>> especially with Google App Engine, which does not like rapid updating of
>>> the
>>> same persistent "entity group".
>>>
>>> My question is: is there a (simple) way for me to know whether my page
>>> is
>>> being constructed during the action part of the request as opposed to
>>> the
>>> render part of the request?
>>>
>>> (I have a work-around in mind, which is to store relevant details in the
>>> session, and use a check on these to prevent a second database
>>> persistence
>>> operation for the same data, but I would have thought that a simpler,
>>> more
>>> direct solution exists.)
>>>
>>> Any hints would be greatly appreciated.
>>>
>>>
>>> MY DEVELOPMENT ENVIRONMENT
>>> Web framework:     Wicket 1.5.7
>>> Java:              1.6.0_33; Java HotSpot(TM) Client VM 20.8-b03
>>> Web server system: Google App Engine for Java version 1.6.6
>>> Operating system:  Microsoft Windows XP Home Edition version 2002 SP3
>>>                   (version 5.1 running on x86; Cp1252; en_GB) (nb)
>>> IDE:               NetBeans IDE 7.1.2 (Build 201204101705)
>>>
>>>
>>> Ian Marshall
>>>
>>> --
>>> View this message in context:
>>> http://apache-wicket.1842946.n4.nabble.com/Wicket-Page-constructor-getting-called-twice-tp4650225.html
>>> Sent from the Users forum mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@.apache
>>> For additional commands, e-mail: users-help@.apache
>>>
>>>
> 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Page-constructor-getting-called-twice-tp4650225p4650254.html
Sent from the Users forum 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

Reply via email to