public void doTag ( ) throws JspException { // First look for the exception in the pageflow/struts request attribute. If it's not there, // look for it in the request attribute the container provides for web.xml-configured error // pages. InternalStringBuilder results = new InternalStringBuilder ( 128 ) ; PageContext pageContext = getPageContext ( ) ; Throwable e = ( Throwable ) pageContext . getAttribute ( Globals . EXCEPTION_KEY , PageContext . REQUEST_SCOPE ) ; if ( e == null ) { ServletRequest req = pageContext . getRequest ( ) ; e = ( Throwable ) req . getAttribute ( "javax.servlet.error.exception" ) ; if ( e == null ) { e = ( Throwable ) req . getAttribute ( "javax.servlet.jsp.jspException" ) ; } } if ( ! _showStackTrace && _showDevModeStackTrace ) { boolean devMode = ! AdapterManager . getServletContainerAdapter ( pageContext . getServletContext ( ) ) . isInProductionMode ( ) ; if ( devMode ) _showStackTrace = true ; } if ( e != null ) { if ( _showMessage ) { String msg = e . getMessage ( ) ; // if we have message lets output the exception name and the name of the if ( ( msg != null ) && ( msg . length ( ) > 0 ) ) { if ( ! _showStackTrace ) msg = e . getClass ( ) . getName ( ) + ": " + msg ; results . append ( HtmlExceptionFormatter . format ( msg , e , _showStackTrace ) ) ; } else { results . append ( HtmlExceptionFormatter . format ( e . getClass ( ) . getName ( ) , e , _showStackTrace ) ) ; } } else { results . append ( HtmlExceptionFormatter . format ( null , e , _showStackTrace ) ) ; } ResponseUtils . write ( pageContext , results . toString ( ) ) ; } }
Render the exception text based on the display attributes .