Hi,
I don't fully understand a concept of state management in Wicket:
"One of the primary objectives was to make state management a Java
thing that is abstracted away from implementation details like
HttpSession. In Wicket, state is stored in components that are nested
in Pages which are all contained in a map in the user's session. All
of this is very well defined and occurs "behind the scenes"."
But in almost all examples available on Wicket pages, every time I
choose a link from one page (Page1) to another one (Page2), a new
instance of that Page2 is created.
Examples:
1. I can do it by placing a link inside a <wicket:link> tags on Page1:
<wicket:link>
<a href="Page2.html">Goto second page</a>
</wicket:link>
2. I can create a link in the Page1 code:
add(new PageLink("linkToPage1", Page1.class));
etc...
But what about a state of that page? I want to have exactly the same
state of Page2, each time when I choose a link to it from other pages.
State is stored inside a page, so should I store a reference to the
first instance of my Page2 somewhere (eg. inside a session object) and
change all of links to Page2 to something like this:
add(new PageLink("linkToPage1", mySession.getPage2Instance()));
Or should I store a page state inside a session manually (in some
object or model instance) and pass this state to the new instance of
Page2 in constructor like this:
add(new PageLink("linkToPage1", new
Page1(mySession.getMySavedModelForPage2())));
But then it does not occur "behind the scenes".
--
Daniel
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user