bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/Generator.java
private void generateTagHandlerPreamble(
        JasperTagInfo tagInfo,
        Node.Nodes tag)
        throws JasperException {

        // Generate package declaration
        String className = tagInfo.getTagClassName();
        int lastIndex = className.lastIndexOf('.');
        if (lastIndex != -1) {
            String pkgName = className.substring(0, lastIndex);
            genPreamblePackage(pkgName);
            className = className.substring(lastIndex + 1);
        }

        // Generate imports
        genPreambleImports();

        // Generate class declaration
        out.printin("public final class ");
        out.println(className);
        out.printil("    extends javax.servlet.jsp.tagext.SimpleTagSupport");
        out.printin(
            "    implements org.apache.jasper.runtime.JspSourceDependent");
        if (tagInfo.hasDynamicAttributes()) {
            out.println(",");
            out.printin(
                "               javax.servlet.jsp.tagext.DynamicAttributes");
        }
        out.println(" {");
        out.println();
        out.pushIndent();

        /*
         * Class body begins here
         */

        generateDeclarations(tag);

        // Static initializations here
        genPreambleStaticInitializers();

        out.printil("private JspContext jspContext;");

        // Declare writer used for storing result of fragment/body invocation
        // if 'varReader' or 'var' attribute is specified
        out.printil("private java.io.Writer _jspx_sout;");

        // Class variable declarations
        genPreambleClassVariableDeclarations(tagInfo.getTagName());

        generateSetJspContext(tagInfo);

        // Tag-handler specific declarations
        generateTagHandlerAttributes(tagInfo);
        if (tagInfo.hasDynamicAttributes())
            generateSetDynamicAttribute();

        // Methods here
        genPreambleMethods();

        // Now the doTag() method
        out.printil(
            "public void doTag() throws JspException, java.io.IOException {");

        if (ctxt.isPrototypeMode()) {
            out.printil("}");
            out.popIndent();
            out.printil("}");
            return;
        }

        out.pushIndent();

        /*
         * According to the spec, 'pageContext' must not be made available as
         * an implicit object in tag files.
         * Declare _jspx_page_context, so we can share the code generator with
         * JSPs. 
         */
        out.printil("PageContext _jspx_page_context = (PageContext)jspContext;");

        // Declare implicit objects.  
        out.printil(
            "HttpServletRequest request = "
                + "(HttpServletRequest) _jspx_page_context.getRequest();");
        out.printil(
            "HttpServletResponse response = "
                + "(HttpServletResponse) _jspx_page_context.getResponse();");
        out.printil("HttpSession session = _jspx_page_context.getSession();");
        out.printil(
            "ServletContext application = _jspx_page_context.getServletContext();");
        out.printil("ServletConfig config = _jspx_page_context.getServletConfig();");
        out.printil("JspWriter out = jspContext.getOut();");
        if (isPoolingEnabled && !tagHandlerPoolNames.isEmpty()) {
            out.printil("_jspInit(config);");
        }
        generatePageScopedVariables(tagInfo);
        out.println();

        out.printil("try {");
        out.pushIndent();
    }
private void generateTagHandlerPreamble(
        JasperTagInfo tagInfo,
        Node.Nodes tag)
        throws JasperException {

        // Generate package declaration
        String className = tagInfo.getTagClassName();
        int lastIndex = className.lastIndexOf('.');
        if (lastIndex != -1) {
            String pkgName = className.substring(0, lastIndex);
            genPreamblePackage(pkgName);
            className = className.substring(lastIndex + 1);
        }

        // Generate imports
        genPreambleImports();

        // Generate class declaration
        out.printin("public final class ");
        out.println(className);
        out.printil("    extends javax.servlet.jsp.tagext.SimpleTagSupport");
        out.printin(
            "    implements org.apache.jasper.runtime.JspSourceDependent");
        if (tagInfo.hasDynamicAttributes()) {
            out.println(",");
            out.printin(
                "               javax.servlet.jsp.tagext.DynamicAttributes");
        }
        out.println(" {");
        out.println();
        out.pushIndent();

        /*
         * Class body begins here
         */

        generateDeclarations(tag);

        // Static initializations here
        genPreambleStaticInitializers();

        out.printil("private JspContext jspContext;");

        // Declare writer used for storing result of fragment/body invocation
        // if 'varReader' or 'var' attribute is specified
        out.printil("private java.io.Writer _jspx_sout;");

        // Class variable declarations
        genPreambleClassVariableDeclarations(tagInfo.getTagName());

        generateSetJspContext(tagInfo);

        // Tag-handler specific declarations
        generateTagHandlerAttributes(tagInfo);
        if (tagInfo.hasDynamicAttributes())
            generateSetDynamicAttribute();

        // Methods here
        genPreambleMethods();

        // Now the doTag() method
        out.printil(
            "public void doTag() throws JspException, java.io.IOException {");

        if (ctxt.isPrototypeMode()) {
            out.printil("}");
            out.popIndent();
            out.printil("}");
            return;
        }

        out.pushIndent();

        /*
         * According to the spec, 'pageContext' must not be made available as
         * an implicit object in tag files.
         * Declare _jspx_page_context, so we can share the code generator with
         * JSPs. 
         */
        out.printil("PageContext _jspx_page_context = (PageContext)jspContext;");

        // Declare implicit objects.  
        out.printil(
            "HttpServletRequest request = "
                + "(HttpServletRequest) _jspx_page_context.getRequest();");
        out.printil(
            "HttpServletResponse response = "
                + "(HttpServletResponse) _jspx_page_context.getResponse();");
        out.printil("HttpSession session = _jspx_page_context.getSession();");
        out.printil(
            "ServletContext application = _jspx_page_context.getServletContext();");
        out.printil("ServletConfig config = _jspx_page_context.getServletConfig();");
        out.printil("JspWriter out = jspContext.getOut();");
        if (isPoolingEnabled && !tagHandlerPoolNames.isEmpty()) {
            out.printil("_jspInit(config);");
        }
        generatePageScopedVariables(tagInfo);
        out.println();

        out.printil("try {");
        out.pushIndent();
    }
private void generateTagHandlerPreamble ( JasperTagInfo tagInfo , Node . Nodes tag ) throws JasperException { // Generate package declaration String className = tagInfo . getTagClassName ( ) ; int lastIndex = className . lastIndexOf ( ' ' ) ; if ( lastIndex != - 1 ) { String pkgName = className . substring ( 0 , lastIndex ) ; genPreamblePackage ( pkgName ) ; className = className . substring ( lastIndex + 1 ) ; } // Generate imports genPreambleImports ( ) ; // Generate class declaration out . printin ( "public final class " ) ; out . println ( className ) ; out . printil ( "    extends javax.servlet.jsp.tagext.SimpleTagSupport" ) ; out . printin ( "    implements org.apache.jasper.runtime.JspSourceDependent" ) ; if ( tagInfo . hasDynamicAttributes ( ) ) { out . println ( "," ) ; out . printin ( "               javax.servlet.jsp.tagext.DynamicAttributes" ) ; } out . println ( " {" ) ; out . println ( ) ; out . pushIndent ( ) ; /*
         * Class body begins here
         */ generateDeclarations ( tag ) ; // Static initializations here genPreambleStaticInitializers ( ) ; out . printil ( "private JspContext jspContext;" ) ; // Declare writer used for storing result of fragment/body invocation // if 'varReader' or 'var' attribute is specified out . printil ( "private java.io.Writer _jspx_sout;" ) ; // Class variable declarations genPreambleClassVariableDeclarations ( tagInfo . getTagName ( ) ) ; generateSetJspContext ( tagInfo ) ; // Tag-handler specific declarations generateTagHandlerAttributes ( tagInfo ) ; if ( tagInfo . hasDynamicAttributes ( ) ) generateSetDynamicAttribute ( ) ; // Methods here genPreambleMethods ( ) ; // Now the doTag() method out . printil ( "public void doTag() throws JspException, java.io.IOException {" ) ; if ( ctxt . isPrototypeMode ( ) ) { out . printil ( "}" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; return ; } out . pushIndent ( ) ; /*
         * According to the spec, 'pageContext' must not be made available as
         * an implicit object in tag files.
         * Declare _jspx_page_context, so we can share the code generator with
         * JSPs. 
         */ out . printil ( "PageContext _jspx_page_context = (PageContext)jspContext;" ) ; // Declare implicit objects.   out . printil ( "HttpServletRequest request = " + "(HttpServletRequest) _jspx_page_context.getRequest();" ) ; out . printil ( "HttpServletResponse response = " + "(HttpServletResponse) _jspx_page_context.getResponse();" ) ; out . printil ( "HttpSession session = _jspx_page_context.getSession();" ) ; out . printil ( "ServletContext application = _jspx_page_context.getServletContext();" ) ; out . printil ( "ServletConfig config = _jspx_page_context.getServletConfig();" ) ; out . printil ( "JspWriter out = jspContext.getOut();" ) ; if ( isPoolingEnabled && ! tagHandlerPoolNames . isEmpty ( ) ) { out . printil ( "_jspInit(config);" ) ; } generatePageScopedVariables ( tagInfo ) ; out . println ( ) ; out . printil ( "try {" ) ; out . pushIndent ( ) ; }
/*
Generates tag handler preamble.
/ * Generates tag handler preamble .