Hielke's response is spot-on. The real question is: why do you need to access parameters in your session? At least your example is concerning - it's not typically a good sign to be pulling the User ID from the request (where it looks like you're using it to create a session for a user).
-- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org* On Fri, May 13, 2011 at 2:58 AM, Hielke Hoeve <[email protected]>wrote: > This is because a session is created only once for each user, until it > expires ofcourse... > If you wish to check url parameters for each request I would suggest you > do this in RequestCycle.onBeginRequest(). There is also > RequestCylce.onEndRequest() if you need to do anything at the end of the > cycle (letting go of variables and what not). > > If you want to check parameters only for a few pages then you could also > choose to use the Page(PageParameters) constructor, wicket will give > that constructor a hashmap with all the parameters from the url. > > Hielke > > -----Original Message----- > From: drf [mailto:[email protected]] > Sent: donderdag 12 mei 2011 15:49 > To: [email protected] > Subject: Getting Parameters from URL > > We have code in our session object as follows: > > public class OurSession extends WebSession { > > public OurSession(Request request)}{ > super(request) > // GET PARAMETERS FROM REQUEST > userId = request.getParameter("userId"); > } > > } > > This works the first time, so if the url has a parameter of userId=JOHN > then this can be picked up in the above code. > However, if the application is again requested from the browser (and the > session already exists), this code will not get called. > What is then the best way to pick up the parameters on the url? > Thanks > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Getting-Parameters-from-URL-t > p3517499p3517499.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
