Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in Tile

 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic