You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/02/19 08:55:28 UTC

[17/19] git commit: Add a FAQ for stateless

Add a FAQ for stateless


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/820e52d9
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/820e52d9
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/820e52d9

Branch: refs/heads/reference-guide
Commit: 820e52d98e6122ce404587ef21fbab67c9d480bc
Parents: 38b272f
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Feb 18 13:53:32 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Feb 18 13:53:32 2013 +0200

----------------------------------------------------------------------
 .../src/documentation/source/stateless.rst         |   17 ++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/820e52d9/wicket-reference-guide/src/documentation/source/stateless.rst
----------------------------------------------------------------------
diff --git a/wicket-reference-guide/src/documentation/source/stateless.rst b/wicket-reference-guide/src/documentation/source/stateless.rst
index 0ff74d2..87930ae 100644
--- a/wicket-reference-guide/src/documentation/source/stateless.rst
+++ b/wicket-reference-guide/src/documentation/source/stateless.rst
@@ -66,7 +66,22 @@ Use `StatelessComponent <http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/
 .. includecode:: ../../../stateless/src/main/java/org/apache/wicket/reference/stateless/CheckedPage.java#check-stateless
 
 
-
+FAQ
+---
+
+1. Why my link/button is not executed after page recreation ?
+
+If Wicket cannot find the old page by any reason (e.g. expired session with all its pages) then depending on the value of IPageSettings#getRecreateMountedPagesAfterExpiry() Wicket may create a new instance for you.
+Now:
+1) if the new instance is stateless then Wicket will execute the listener interface, i.e. will execute StatelessLink#onClick, StatelessForm#onSubmit, ...
+2) if the newly created page is stateful Wicket will just render it *without* executing the listener interface
+Why ? Because the stateless link/form/behavior/... may or may not be in the page component tree. Wicket cannot make assumptions that the component/behavior exists in the page initial state (i.e. right after instantiating it). The link that your user has clicked on the expired page may have been added in state 2 of the page, and thus it is not available in state 1 (the initial state).
+
+Use case:
+- render a simple stateful page with just linkA and am empty panel
+- the user clicks on linkA which replaces the empty panel with a panel with linkB inside
+- later the user clicks on linkB
+- if the session is expired and Wicket creates a new instance of the page then linkB is not in the component tree. Only linkA and the empty panel are there. Once linkA is used linkB will appear, but Wicket cannot do this because it doesn't know what to do to get linkB and execute its onClick() method