001    package jsp.jsp2.simpletag;
002    
003    import javax.servlet.*;
004    import javax.servlet.http.*;
005    import javax.servlet.jsp.*;
006    
007    public final class repeat_jsp extends org.apache.jasper.runtime.HttpJspBase
008        implements org.apache.jasper.runtime.JspSourceDependent {
009    
010      private static java.util.List _jspx_dependants;
011    
012      public Object getDependants() {
013        return _jspx_dependants;
014      }
015    
016      public void _jspService(HttpServletRequest request, HttpServletResponse response)
017            throws java.io.IOException, ServletException {
018    
019        JspFactory _jspxFactory = null;
020        PageContext pageContext = null;
021        HttpSession session = null;
022        ServletContext application = null;
023        ServletConfig config = null;
024        JspWriter out = null;
025        Object page = this;
026        JspWriter _jspx_out = null;
027        PageContext _jspx_page_context = null;
028    
029    
030        try {
031          _jspxFactory = JspFactory.getDefaultFactory();
032          response.setContentType("text/html");
033          pageContext = _jspxFactory.getPageContext(this, request, response,
034                            null, true, 8192, true);
035          _jspx_page_context = pageContext;
036          application = pageContext.getServletContext();
037          config = pageContext.getServletConfig();
038          session = pageContext.getSession();
039          out = pageContext.getOut();
040          _jspx_out = out;
041    
042          out.write("<!--\n Licensed to the Apache Software Foundation (ASF) under one or more\n  contributor license agreements.  See the NOTICE file distributed with\n  this work for additional information regarding copyright ownership.\n  The ASF licenses this file to You under the Apache License, Version 2.0\n  (the \"License\"); you may not use this file except in compliance with\n  the License.  You may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n\n<html>\n  <head>\n    <title>JSP 2.0 Examples - Repeat SimpleTag Handler</title>\n  </head>\n  <body>\n    <h1>JSP 2.0 Examples - Repeat SimpleTag Handler</h1>\n    <hr>\n    <p>This tag handler accepts a \"num\" parameter and repeats the body of the\n");
043          out.write("    tag \"num\" times.  It's a simple example, but the implementation of \n    such a tag in JSP 2.0 is substantially simpler than the equivalent \n    JSP 1.2-style classic tag handler.</p>\n    <p>The body of the tag is encapsulated in a \"JSP Fragment\" and passed\n    to the tag handler, which then executes it five times, inside a \n    for loop.  The tag handler passes in the current invocation in a\n    scoped variable called count, which can be accessed using the EL.</p>\n    <br>\n    <b><u>Result:</u></b><br>\n    ");
044          //  mytag:repeat
045          jsp2.examples.simpletag.RepeatSimpleTag _jspx_th_mytag_repeat_0 = new jsp2.examples.simpletag.RepeatSimpleTag();
046          _jspx_th_mytag_repeat_0.setJspContext(_jspx_page_context);
047          _jspx_th_mytag_repeat_0.setNum(5);
048          _jspx_th_mytag_repeat_0.setJspBody(new repeat_jspHelper( 0, _jspx_page_context, _jspx_th_mytag_repeat_0, null));
049          _jspx_th_mytag_repeat_0.doTag();
050          out.write("\n  </body>\n</html>\n");
051        } catch (Throwable t) {
052          if (!(t instanceof SkipPageException)){
053            out = _jspx_out;
054            if (out != null && out.getBufferSize() != 0)
055              out.clearBuffer();
056            if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
057          }
058        } finally {
059          if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
060        }
061      }
062    
063      private class repeat_jspHelper
064          extends org.apache.jasper.runtime.JspFragmentHelper
065      {
066        private javax.servlet.jsp.tagext.JspTag _jspx_parent;
067        private int[] _jspx_push_body_count;
068    
069        public repeat_jspHelper( int discriminator, JspContext jspContext, javax.servlet.jsp.tagext.JspTag _jspx_parent, int[] _jspx_push_body_count ) {
070          super( discriminator, jspContext, _jspx_parent );
071          this._jspx_parent = _jspx_parent;
072          this._jspx_push_body_count = _jspx_push_body_count;
073        }
074        public void invoke0( JspWriter out ) 
075          throws Throwable
076        {
077          out.write("\n      Invocation ");
078          out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${count}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
079          out.write(" of 5<br>\n    ");
080          return;
081        }
082        public void invoke( java.io.Writer writer )
083          throws JspException
084        {
085          JspWriter out = null;
086          if( writer != null ) {
087            out = this.jspContext.pushBody(writer);
088          } else {
089            out = this.jspContext.getOut();
090          }
091          try {
092            switch( this.discriminator ) {
093              case 0:
094                invoke0( out );
095                break;
096            }
097          }
098          catch( Throwable e ) {
099            if (e instanceof SkipPageException)
100                throw (SkipPageException) e;
101            throw new JspException( e );
102          }
103          finally {
104            if( writer != null ) {
105              this.jspContext.popBody();
106            }
107          }
108        }
109      }
110    }