You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Peterson <da...@crowdsoft.com> on 2007/06/25 19:26:08 UTC

T5: Problem returning a page from onActivate()

Can you help me? What I'm trying to do is redirect to another page, if my
page has not been given any context.

Something like this:

    Object onActivate(String context) {
         if (context == null) {
              return _otherPage;
         }
         return null;
    }

Unfortunately that method does not get run if the context is missing.

So, I tried:

    Object onActivate() {
          return _otherPage;
    }

But this method is run even if there is a context. And it's run before the
other one, so I can't even set a flag. I've tried returning the page from
setupRender() instead, but that expects a boolean result and doesn't work.
So, what do I do?

And a related question: how can I do a: response.sendError(404, "Entry not
found"); This works, but I get an error in the logs - the
PageRenderRequestHandler is still trying to render a (non-existent)
document.

Thanks,
David