File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Wrath of incompatible throws clause in SimpleTagSupport.doTag() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Wrath of incompatible throws clause in SimpleTagSupport.doTag()" Watch "Wrath of incompatible throws clause in SimpleTagSupport.doTag()" New topic
Author

Wrath of incompatible throws clause in SimpleTagSupport.doTag()

Jacob Fenwick
Ranch Hand

Joined: Apr 28, 2006
Posts: 55
I've been pressing for increased use of tags, beans, and EL, but I keep running into a problem. There is much weeping and gnashing of teeth whenever someone needs to throw an exception as you need to wrap everything in JspException.
This sort of ruins our whole exception framework, as previously we would throw exceptions up the hierarchy to the JSP, and we could see what kind of errors it was at the top, but since JspException wraps everything now we have to dig down to find the real exception.
Is there a way around this?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61606
    
  67

JspException is a wrapper exception in which you record the actual exception as the root cause.

For example, in order to have your cake and eat it too within a method that only allows throwing a JspException:



By supplying the root exception as the 2nd paramter to the JspException constructor, it is propogated and reported as the root cause.

ServletException is another example of a wrapper exception.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Wrath of incompatible throws clause in SimpleTagSupport.doTag()