You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mark Takacs <ta...@coscend.com> on 2001/07/16 20:51:29 UTC

template tag hides custom taglib exceptions

Summary:

our custom taglib exceptions are being masked from the Jsp errorPages by
our usage of the struts template taglibs. Is there a way we can
percolate our exceptions to the JSP error pages?

Details

We're running using WebLogic 6.0 on Linux.

We've been using struts for about six months now and are reasonably
pleased with it. However, using the template tags masks the exceptions
thrown by our custom taglibs. It's not a big problem for our developers,
since we can look at the server logs to get the full stack traces.
However, the error handlers we show via our web GUI are useless for our
QA to base bug reports on.

For instance, we have a mapping in struts-config.xml like

<action path="/login"
....
input="/templates/login.jsp"


The input template looks like this

<%@ taglib prefix="template" uri=
"http://jakarta.apache.org/struts/template"
<http://jakarta.apache.org/struts/template> %>
<template:insert template="basic.jsp">
<template:put name="title" content="/pages/bits/title.jsp" />
<template:put name="content" content="/pages/login.jsp" />
<template:put name="header" content="/pages/bits/header.jsp" />
<template:put name="footer" content="/pages/bits/footer.jsp" />
</template:insert>

Basic.jsp is also straightforward, simply placing the template elements
on the page. Here's a snippet.

<tr>
<td align="center" border="0"><template:get name="content"/></td>
</tr>

and then we've got your typical login.jsp page with a few custom taglibs
of our own design. The problem occurs when we get an exception in our
taglibs. The Expection is thrown within our taglibs , but the JSP
ErrorPages show

Exception found onErrorPage

javax.servlet.ServletException: runtime failure in custom tag 'get'
	at jsp_servlet._templates._basic._jspService(_basic.java:196)
	at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
         ....

RootCause() is

javax.servlet.jsp.JspException
	at org.apache.struts.taglib.template.GetTag.doStartTag(GetTag.java:193)
	at jsp_servlet._templates._basic._jspService(_basic.java:18)
         .....

The Offending line in basic.jsp is the insertion of the "login.jsp" page
with our custom taglib which has thrown an exception. Yet JspException
doesn't define a getRootCause() call, so our tablib exception (usually a
runtime one) is completely masked from our QA team via the GUI. The
server logging we have in place clearly shows the Exception (in this
case a SQL connection problem), but we can't get that information up to
our exception page..

Is there a solution to this problem? I've heard that future JSP specs
allow for nested/hierachical Exceptions in JspException. Until then,
does anyone have suggestions or current practices of how you handle
expections that are masked by other taglibs?


-tak