public int doStartTag ( ) throws JspException { ServletRequest req = pageContext . getRequest ( ) ; Template . TemplateContext tc = ( Template . TemplateContext ) req . getAttribute ( TEMPLATE_SECTIONS ) ; if ( tc == null ) { String s = Bundle . getString ( "Tags_TemplateContextMissing" ) ; // report the error. If this returns a value then we throw an // exception logger . warn ( stripBold ( s ) ) ; registerTagError ( s , null ) ; reportErrors ( ) ; localRelease ( ) ; return SKIP_BODY ; } if ( tc . secs == null ) { if ( _default != null ) { return callDefault ( req ) ; } String s = Bundle . getString ( "Tags_TemplateSectionMissing" , new Object [ ] { _name } ) ; // report the error. If this returns a value then we throw an // exception logger . warn ( stripBold ( s ) ) ; registerTagError ( s , null ) ; reportErrors ( ) ; localRelease ( ) ; return SKIP_BODY ; } String val = ( String ) tc . secs . get ( _name ) ; if ( val == null ) { if ( _default == null ) { String s = Bundle . getString ( "Tags_TemplateSectionMissing" , new Object [ ] { _name } ) ; logger . warn ( stripBold ( s ) ) ; // report the error. If this returns a value then we throw an // exception registerTagError ( s , null ) ; reportErrors ( ) ; localRelease ( ) ; return SKIP_BODY ; } return callDefault ( req ) ; } try { Writer out = pageContext . getOut ( ) ; out . write ( val ) ; } catch ( IOException e ) { String reason = Bundle . getString ( "TempExcp_WritingContent" ) ; String s = Bundle . getString ( "TempExcp_Except" , new Object [ ] { "IOException" , reason } ) ; logger . error ( s ) ; JspException jspException = new JspException ( s , e ) ; // todo: future cleanup // The 2.5 Servlet api will set the initCause in the Throwable superclass during construction, // this will cause an IllegalStateException on the following call. if ( jspException . getCause ( ) == null ) { jspException . initCause ( e ) ; } throw jspException ; } // continue to evalue the page...(This should be a template) localRelease ( ) ; return SKIP_BODY ; }
Renders the content of the section into the template . Errors are reported inline within the template in development mode . If no sections are defined an error is reported . If a section is not defined and no default URL is provided an error is reported .