public class MySession extends WebSession {
private String myAttribute;
// ... getters and setters
}
and override either of the following methods on your Application class:
/**
* @see wicket.Application#getSessionFactory()
*/
protected ISessionFactory getSessionFactory()
{
return this.sessionFactory;
}
/**
* Create new Wicket Session object. Note, this method is not called
* if you registered your own ISessionFactory with the Application.
*
* @see wicket.ISessionFactory#newSession()
*/
public Session newSession()
{
return new WebSession( WebApplication.this);
}
Martijn
Hi
I have an object I would like to have stored in session, so that I may pass it between pages. I've been looking at some sniplets and created this code for setting the object:
HttpServletRequest request = ((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest();
request.setAttribute("here", "Hello world");
I am setting the value on the base of a panel which holds a button that contains the below code in a onsubmit override.
And this piece for getting the value:
HttpServletRequest request = ((WebRequest) RequestCycle.get().getRequest()).getHttpServletRequest();
String Message = (String) request.getAttribute("here");
info(Message);
I am getting the value on a onsubmit of a button.
However my String(message) are null how can that be, does it have something to do with the scope?? If I paste the getting code in the same place as my setting code it works just fine.
I do also feel that this is not 100% the wicket way to do it, so I must have overlooked the better way?
--
Wicket 1.2 is coming! Write Ajax applications without touching _javascript_!
-- http://wicketframework.org