I believe that also gets covered on the website: http://tapestry.apache.org/tapestry4.1/developmentguide/exceptionpages.html
On 12/3/06, Sam Gendler <[EMAIL PROTECTED]> wrote:
In hivmind.xml: <contribution configuration-id="tapestry.InfrastructureOverrides"> <property name="exceptionPageName" value="CustomExceptionPage"/> </contribution> In your template for the custom exception: <span jwcid="exception"/> will render the exception if you have the following in your .page file: <component id="exception" type="ExceptionDisplay"> <binding name="exceptions" value="ognl:exceptions"/> </component> You can also use the following to render the request <component id="request" type="RequestDisplay" /> My class looks like this: public abstract class CustomExceptionPage extends StaticBasePage implements PageDetachListener { public abstract void setExceptions(ExceptionDescription[] exceptions); private static Logger log = Logger.getLogger(CustomExceptionPage.class); public void setException(Throwable value) { log.error(value, value); ExceptionAnalyzer analyzer = new ExceptionAnalyzer(); ExceptionDescription[] exceptions = analyzer.analyze(value); setExceptions(exceptions); } } I don't remember where I got all that from, but it was either Kent Tong's book or the user guide on the Tapestry website. There is a small chance I found it in "Tapestry in Action" which is the Tap 3 book. --sam On 12/3/06, Cyrille37 <[EMAIL PROTECTED]> wrote: > Hello, > I'm still learning Tapestry, and generally Java Web Application ... > Now I can understand a beat about Tapestry and create little working > project. > Here is the time for me to learn how to manage errors, like trapping an > underground exception in the view layer. > > The following example is from the "Kent Tong 's book" source code: the > "shop" example. > There is a page to view shop's products details: > ProductDetails(.html,.page,.java). > > In ProductDetails.java there are accessors for a product details like : > public String getName() { > return lookup().getName(); > } > public String getDesc() { > return lookup().getDesc(); > } > public double getPrice() { > return lookup().getPrice(); > } > The lookup method to get a Product is : > private Product lookup() { > return Catalog.getGlobalCatalog().lookup(getProductId()); > } > > In ProductDetails.page there are components like : > <component id="name" type="Insert"> > <binding name="value" value="name"/> > </component> > <component id="desc" type="Insert"> > <binding name="value" value="desc"/> > </component> > <component id="price" type="Insert"> > <binding name="value" value="price"/> > </component> > > How can I catch an exception throwed by > Catalog.getGlobalCatalog().lookup(getProductId()) when a ProductId is > not valid (does not exists) ? > I would like to display a nicer page than the default Tapestry's > Exception page. > The problem is that the exception occurs while parsing the > ProductDetails's specification page (ProductDetails.page) where > components are binded. > > Have you got any idea or method on how to manage that kind of problems ? > > thanks a lot for your experience share. > Cyrille. > > > > --------------------------------------------------------------------- > 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]
-- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]