Alright, so from what you guys have said, I think there is a bug. I had not called session.dirty() before, but since that sounded reasonable, I took out the call to session.bind() and updated my property setter so that after it set the value, it called dirty. In this simple case: public Integer getX() { return this.x; }
public void setX(Integer x) { this.x = x; this.dirty(); } In an otherwise stateless page, I have the following code: public Index(final PageParameters parameters) { ... MySession s = (MySession) MySession.get(); s.setX( s.getX()+1 ); add(new Label("xlabel", new Model(s.getX()))); ... } The expectation is that the value will increment with each refresh. In reality, a new session gets created for each request, and the value remains the same. So I think that dirty() is not working when there is no state already established? When I add the session.bind() in the application's newSession() method, everything works as expected. Hope this is helpful. Spencer igor.vaynberg wrote: > > On 7/24/07, spencer.c <[EMAIL PROTECTED]> wrote: >> >> >> Thanks Eelco, that did the trick. >> >> Couple of follow up questions/comments that anyone can field: >> 1) I understand why you would want a stateless application, however I >> don't >> understand why you would ever want your session to be regenerated on each >> request if during the request you specifically set a session value. It >> seems like once you set a session value, the session should become bound. >> Is there a logical reason this isn't the case, or is it just a >> technological/implementation reason? I'm just trying to understand this >> better. > > > after you set the value on the session did you call session.dirty() to let > wicket know you have done that? i think dirty() will bind the session as > well. > > -igor > > > > > 2) The location quoted for the live examples >> (http://wicketstuff.org/wicket13/) is the one I was looking at, however >> for >> the specific example "stateless", it is not possible to view the source >> code >> and/or page files "live". Not sure how the site is maintained, but >> perhaps >> a download link could be added on the examples page to the build that the >> live examples demonstrate, by default. I've got the files now however, >> so >> thanks again! >> >> Best regards, >> >> Spencer >> >> >> >> Eelco Hillenius wrote: >> > >> >> I have a custom session class that inherits from WebSession. I have >> >> overridden the newSession method in my Application class. The session >> is >> >> getting used during the request, because I initialize some of its >> values >> >> in >> >> its constructor, and they show up when I attach a label to them in a >> >> page. >> >> A new session gets created with every request, however, which >> obviously >> >> is >> >> not the desired behavior. For instance, I have an Integer, and I >> >> initialize >> >> it to 1 in the constructor, and increment it before each page >> display. I >> >> always get back a 2 on the page. >> > >> > It sounds like your page is stateless, and the session instances are >> > temporary. As long as a session is not 'bound', you'll get a separate >> > instance per request and Wicket won't hold on to heap memory. You can >> > force the creation of a session by calling Session#bind, which I think >> > you should be able to call from your constructor as well. >> > >> >> Related to this, can someone provide me a download link to the 1.3 >> >> examples? >> >> The live examples page does not allow you to view the source for the >> >> stateless example, which seems like it may have some relevant code in >> it, >> >> and I cannot find a download link for the 1.3 examples. The >> 1.2examples >> >> do >> >> not have that particular example, from what I can tell. >> > >> > Use http://wicketstuff.org/wicket13/ to look at the examples. The >> > wicket-examples site is stale. >> > >> > As for downloading the examples for 1.3.0, at this time you can best >> > get them from SVN directly, or download them from our maven repo at >> > >> http://wicketstuff.org/maven/repository/org/apache/wicket/wicket-examples/1.3.0-SNAPSHOT/ >> > >> > Eelco >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Custom-session-not-working...-tf4132685.html#a11761829 >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> Wicket-user mailing list >> Wicket-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- View this message in context: http://www.nabble.com/Custom-session-not-working...-tf4132685.html#a11769841 Sent from the Wicket - User mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user