Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

how to catch an exception and do some customized error handling ?

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I heard some people said "not to catch any exception" in Action or anywhere, just let them flow, struts can handle it and eventually it can be reflected in the JSP. Is that true ?

However, in one of my project, I am REQUIRED to redirect the page to a company customized error page when a specific exception appears. For example, if "No sufficient Fund exception" appears we need to direct to the bank's specific warning page. Is this doable and how ? please advise as I have not much struts experience yet.
 
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as long as the exception thrown to the framework extends java.lang.Exception, struts will handle it provided that you define what to do with the exception. in your struts-config.xml, you can define exception globally (SessionExpiredException is a good example) or locally to an action (InsufficientFundException). each exception can be mapped (using the path attribute) to a jsp, tiles definition, or action mapping. -/a
 
steve francisco
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
many thanks to you, alan !
 
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic