Hi Daniel,

In Tapestry there are so many good features concerning exception handling and 
reporting, you have the flexibility to deal with them in whatever way suites 
you best. Look at the onException tapestry event handler, it may be what you 
want, so something like:

Object onException(Throwable e){
 //activate redirect page here
 return redirectPageObject();
}

I use this in a base page which saves me having to duplicate it in every page.

Dealing with container level exceptions (404, 500 etc) is also straightforward, 
the link provided by Carl gives you some of the details, but it is also 
possible (IMHO better) to just use a static html page or a .jsp page for your 
Container level errors, for example:

 <error-page>
    <error-code>404</error-code>
    <location>/error404.jsp</location>
  </error-page>

and then place the error404.jsp file outside WEB-INF (i.e.: in WebContent) in 
the applications root. So you wont need this any more:
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>

And it works almost all containers.

Cheers,
Peter

----- Original Message -----
From: "Carl Crowder" <carl.crow...@taptu.com>
To: "Tapestry users" <users@tapestry.apache.org>
Sent: Friday, 10 April, 2009 00:28:57 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: Re: Customized error pages, handling of bad values passed to 
OnActivate()

When tapestry throws an excpetion it gets handled by the exception 
report page - http://wiki.apache.org/tapestry/Tapestry5ExceptionPage
You can override that.

For other generic errors such as 404, check out 
http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryForCustomErrorPages 


daniel joyce wrote:
> Lets say a user bookmarks a path like view/123
> 
> This is supposed to allow them to go a tapestry page that will display
> info on Project 123.
> 
> ViewProject.java has a onActivate(Integer projectNum)
> 
> What happens if the user types in view/hshqwueh ?
> 
> I know Tapestry will balk on trying to convert that string to a Integer.
> 
> Does tapestry throw an exception? Can I trap it and redirect to an
> error page? Has the suggestion of easily implmenting custom
> 505/404/etc pages in Tapestry been implemented?
> 
> -Daniel
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to