Right, <img src=""/> 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 <nheudec...@gmail.com> wrote: > I've only seen this type of behavior if I have an empty <img src=""/> > element or something similar. > > > > On Mon, Jun 25, 2012 at 11:45 AM, Ian Marshall > <ianmarshall...@gmail.com>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-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org