title: How to store user data in session using Wicket?
body: <p><em>I am learning Wicket using "Wicket in Action" book.</em></p>
  
  <h2>What I did (safe to skip)</h2>
  
  <p>I would like to create such workflow:</p>
  
  <ul>
  <li>user opens the page for the first time -- "user not logged in" is printed out</li>
  <li>user goes to log-in page</li>
  <li>user logs in (successfully)</li>
  <li>user is redirected to main page -- and info about user is printed out</li>
  </ul>
  
  <p>It is all described in the book, and in theory it looks OK. There is a class for user data (<code>UserData</code>), and there is class session (<code>MySession</code>) which holds user data. Session is created in Wicket <code>MyWebApplication</code>, on call of <code>newSession</code> method.</p>
  
  <p>But the result is -- it does not work. </p>
  
  <h2>The problem</h2>
  
  <p>User data are deleted just after successful logging in. The problem is creating session:</p>
  
  <ul>
  <li>entering the page, plus</li>
  <li>going to log-in page, plus</li>
  <li>getting back to main page</li>
  </ul>
  
  <p>results in 6 created sessions. Of course each new session kills previous one, and with it all data. </p>
  
  <p><strong>Question:</strong> so how to store user data in session properly, or rather how to make a session work like a real session?</p>