Skip to content

How to do redirects in tapestry

How to do client-side redirects-after-post (taken from someone else’s sample code):

public abstract class somePage extends ATapestryPage {
   public abstract IEngineService getPageService();
   public ILink theListenerMethod() {

Redirect to next page. SECURITY NOTE – do not use simple page activation Instead, we return an ILink because that instructs Tapestry to do a redirect-after-post. Redirect-after-post protects against a security vulnerability in which a user may log in without a password simply by using a browser that has been logged out, then using the Back button to go back to the first screen after the login screen and pressing refresh. Without redirect-after-post this would re-post the login info and they’d be logged in!

      ILink redirectTo = getPageService().getLink(false, WelcomePage.PAGE_NAME);
      return redirectTo;

To do a server-side redirect, throw a org.apache.tapestry.PageRedirectException that was created with the desired page to redirect to.

Posted in tapestry.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.