Logging Out- Invalidating Session and Redirect has been edited by Igor Vaynberg (Jan 16, 2008).

(View changes)

Content:

Add the following to your corresponding WebPage...

...

Link logoutLink = new Link("my-link-wicket-id") {

	public void onClick() {
		// you can use "getSession().invalidateNow();" if you want to remove all wicket components from the session
		getSession().invalidate();
		getRequestCycle().setRedirect(true);
		/* it is important to use setResponsePage() variant that takes a page class and not
		   a page instance because a page instance would be stored in session that is now marked
		   for invalidation - thus resulting in a page expired error */
		setResponsePage(WhereEverYouWantToRedirect.class);
	}
};

...

Reply via email to