heserverside.com/articles/article.tss?l=RedirectAfterPost" >as described at the serverside and that is commonly known as Redirect after post. Wicket takes it one step further to do any rendering after a redirect, so that not only form submits are shielded from the double submit problem, but also the IRequestListener handlers (that could be e.g. a link that deletes a row). With this pattern, you have two options to choose from:
- IRequestCycleSettings.RenderStrategy.REDIRECT_TO_RENDER. This option first handles the 'action' part of the request, which is either page construction (bookmarkable pages or the home page) or calling a IRequestListener handler, such as Link.onClick. When that part is done, a redirect is issued to the render part, which does all the rendering of the page and its components. Be aware that this may mean, depending on whether you access any models in the action part of the request, that attachment and detachment of some models is done twice for a request.
- IRequestCycleSettings.RenderStrategy.REDIRECT_TO_BUFFER. This option handles both the action- and the render part of the request in one physical request, but instead of streaming the result to the browser directly, it is kept in memory, and a redirect is issue to get this buffered result (after which it is immediately removed). This option currently is the default render strategy, as it shields you from the double submit problem, while being more efficient and less error prone regarding to detachable models.
Note: In rare cases the strategies involving redirect may lose session data! For example: if after the first phase of the strategy the server node fails without having the chance to replicate the session then the second phase will be executed on another node and the whole process will be restarted and thus anything stored in the first phase will be lost with the failure of the server node. For similar reasons it is recommended to use sticky sessions when using redirect strategies.
More documentation is available about each setting in the setter method for the property.
@author Igor Vaynberg (ivaynberg)