public int doEndTag ( ) throws JspException { if ( _name . length ( ) == 0 ) { String msg = Bundle . getErrorString ( "Tags_DeclareBundle_invalidName" , new Object [ ] { _name } ) ; registerTagError ( msg , null ) ; } if ( _name . equals ( BundleMap . DEFAULT_STRUTS_BUNDLE_NAME ) ) { String msg = Bundle . getErrorString ( "Tags_DeclareBundle_defaultIsReservedWord" , null ) ; registerTagError ( msg , null ) ; } if ( _bundlePath . length ( ) == 0 ) { String msg = Bundle . getErrorString ( "Tags_DeclareBundle_invalidResourcePath" , new Object [ ] { _bundlePath } ) ; registerTagError ( msg , null ) ; } Locale locale = getCurrentLocale ( ) ; if ( hasErrors ( ) ) { reportErrors ( ) ; return EVAL_PAGE ; } BundleMap bundleMap = null ; Object obj = pageContext . getAttribute ( "bundle" ) ; if ( obj == null ) { // NetUI v2 -- in JSP 2.0 EL, the BundleMap is dropped into the PageContext so that // it's available to the EL runtime. bundleMap = new BundleMap ( ( HttpServletRequest ) pageContext . getRequest ( ) , pageContext . getServletContext ( ) ) ; pageContext . setAttribute ( "bundle" , bundleMap ) ; } else if ( ! ( obj instanceof BundleMap ) ) { String msg = Bundle . getErrorString ( "Tags_DeclareBundle_wrongContextType" , new Object [ ] { obj . getClass ( ) . getName ( ) } ) ; registerTagError ( msg , null ) ; if ( hasErrors ( ) ) reportErrors ( ) ; return EVAL_PAGE ; } else bundleMap = ( BundleMap ) obj ; bundleMap . registerResourceBundle ( _name , _bundlePath , locale ) ; return EVAL_PAGE ; }
Register a ResourceBundle that is available for the scope of this page . Errors raised during the execution of this tag will be reported in the page which will continue rendering .