• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error in Tile

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a throwError.jsp page that simply throws an Exception. The page is the main body content tile, and it is surrounded my several menu related tiles. When I request the url that allows me to see throwError.jsp, all the tiles render just fine except for the throwError tile - it contains a log message that says a ServletException occurred. My problem is, I want any runtime exceptions that occur in throwError.jsp, or any other main body content tiles, to cause the main body content to be filled out with a custom error page. I've tried the following methods, but I still see the log message in the main body content section:

1) In web.xml

2) In struts-config.xml

3) Even tried a JSTL <c:catch> tag that I included in my layout that surrounded <tiles:get name="body" />

None of these methods worked. I'm still seeing the server's exception log. What can I do to see custom content in the main body section if an Exception occurs? Thanks a lot in advance.
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a last resort, I included

in my main body content tile and that allowed me to see all of my menu tiles just fine and my custom error content in the main body instead of the error log.

I am not happy with this solution though because it means that I must set the errorPage in all of my main body content tiles.

Does anyone know a workaround for this? Thanks.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's how it works in jsps AFAIK. If your Actions throw an exception it will be handled by your global-exception but an error on the jsp needs the errorPage for the redirect. I would argue that your jsp should be structured so that an exception can not occur as it should contain presentation logic and not business logic.
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I would argue that your jsp should be structured so that an exception can not occur as it should contain presentation logic and not business logic.



It is structured that way, but I'm paranoid about potential errors in custom tags
 
reply
    Bookmark Topic Watch Topic
  • New Topic