home *** CD-ROM | disk | FTP | other *** search
Wrap
package org.apache.jsp.tagplugin; import java.io.IOException; import java.util.Collection; import java.util.Enumeration; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.servlet.jsp.JspFactory; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.SkipPageException; import org.apache.jasper.runtime.HttpJspBase; import org.apache.jasper.runtime.JspSourceDependent; import org.apache.jasper.runtime.PageContextImpl; import org.apache.jasper.runtime.ProtectedFunctionMapper; import org.apache.jasper.runtime.TagHandlerPool; public final class foreach_jsp extends HttpJspBase implements JspSourceDependent { private static Vector _jspx_dependants; private TagHandlerPool _jspx_tagPool_c_forEach_var_end_begin; private TagHandlerPool _jspx_tagPool_c_forEach_var_items; // $FF: synthetic field static Class class$java$lang$String; // $FF: synthetic field static Class class$java$lang$Object; private Iterator toIterator(Object[] a) { return new 1(this, a); } private Iterator toIterator(boolean[] a) { return new 2(this, a); } private Iterator toIterator(byte[] a) { return new 3(this, a); } private Iterator toIterator(char[] a) { return new 4(this, a); } private Iterator toIterator(short[] a) { return new 5(this, a); } private Iterator toIterator(int[] a) { return new 6(this, a); } private Iterator toIterator(long[] a) { return new 7(this, a); } private Iterator toIterator(float[] a) { return new 8(this, a); } private Iterator toIterator(double[] a) { return new 9(this, a); } private Iterator toIterator(Enumeration e) { return new 10(this, e); } public List getDependants() { return _jspx_dependants; } public void _jspInit() { this._jspx_tagPool_c_forEach_var_end_begin = TagHandlerPool.getTagHandlerPool(this.getServletConfig()); this._jspx_tagPool_c_forEach_var_items = TagHandlerPool.getTagHandlerPool(this.getServletConfig()); } public void _jspDestroy() { this._jspx_tagPool_c_forEach_var_end_begin.release(); this._jspx_tagPool_c_forEach_var_items.release(); } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { JspFactory _jspxFactory = null; PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html"); pageContext = _jspxFactory.getPageContext(this, request, response, (String)null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); out.write("<!--\r\n Copyright 2004 The Apache Software Foundation\r\n\r\n Licensed under the Apache License, Version 2.0 (the \"License\");\r\n you may not use this file except in compliance with the License.\r\n You may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n Unless required by applicable law or agreed to in writing, software\r\n distributed under the License is distributed on an \"AS IS\" BASIS,\r\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n See the License for the specific language governing permissions and\r\n limitations under the License.\r\n-->\r\n<html>\r\n <head>\r\n <title>Tag Plugin Examples: forEach</title>\r\n </head>\r\n <body>\r\n <h1>Tag Plugin Examples - <c:forEach></h1>\r\n\r\n <hr>\r\n </br>\r\n <a href=\"notes.html\">Plugin Introductory Notes<font <font color=\"#0000FF\"></\r\na>\r\n <br/>\r\n <a href=\"howto.html\">Brief Instructions for Writing Plugins<font color=\"#0000\r\nFF\"></a>\r\n <br/> <br/>\r\n <hr>\r\n\r\n <font color=\"#000000\"/>\r\n"); out.write(" </br>\r\n\r\n \r\n \r\n\r\n <h3>Iterating over a range</h3>\r\n "); for(int _jspx_temp0 = 1; _jspx_temp0 <= 10; ++_jspx_temp0) { _jspx_page_context.setAttribute("item", String.valueOf(_jspx_temp0)); out.write("\r\n "); out.write((String)PageContextImpl.proprietaryEvaluate("${item}", class$java$lang$String == null ? (class$java$lang$String = class$("java.lang.String")) : class$java$lang$String, _jspx_page_context, (ProtectedFunctionMapper)null, false)); out.write("\r\n "); } out.write("\r\n\r\n "); Vector v = new Vector(); v.add("One"); v.add("Two"); v.add("Three"); v.add("Four"); pageContext.setAttribute("vector", v); out.write("\r\n\r\n <h3>Iterating over a Vector</h3>\r\n\r\n "); Object _jspx_temp1 = PageContextImpl.proprietaryEvaluate("${vector}", class$java$lang$Object == null ? (class$java$lang$Object = class$("java.lang.Object")) : class$java$lang$Object, _jspx_page_context, (ProtectedFunctionMapper)null, false); Iterator _jspx_temp2 = null; if (_jspx_temp1 instanceof Object[]) { _jspx_temp2 = this.toIterator(_jspx_temp1); } else if (_jspx_temp1 instanceof boolean[]) { _jspx_temp2 = this.toIterator((boolean[])_jspx_temp1); } else if (_jspx_temp1 instanceof byte[]) { _jspx_temp2 = this.toIterator((byte[])_jspx_temp1); } else if (_jspx_temp1 instanceof char[]) { _jspx_temp2 = this.toIterator((char[])_jspx_temp1); } else if (_jspx_temp1 instanceof short[]) { _jspx_temp2 = this.toIterator((short[])_jspx_temp1); } else if (_jspx_temp1 instanceof int[]) { _jspx_temp2 = this.toIterator((int[])_jspx_temp1); } else if (_jspx_temp1 instanceof long[]) { _jspx_temp2 = this.toIterator((long[])_jspx_temp1); } else if (_jspx_temp1 instanceof float[]) { _jspx_temp2 = this.toIterator((float[])_jspx_temp1); } else if (_jspx_temp1 instanceof double[]) { _jspx_temp2 = this.toIterator((double[])_jspx_temp1); } else if (_jspx_temp1 instanceof Collection) { _jspx_temp2 = ((Collection)_jspx_temp1).iterator(); } else if (_jspx_temp1 instanceof Iterator) { _jspx_temp2 = (Iterator)_jspx_temp1; } else if (_jspx_temp1 instanceof Enumeration) { _jspx_temp2 = this.toIterator((Enumeration)_jspx_temp1); } else if (_jspx_temp1 instanceof Map) { _jspx_temp2 = ((Map)_jspx_temp1).entrySet().iterator(); } while(_jspx_temp2.hasNext()) { _jspx_page_context.setAttribute("item", _jspx_temp2.next()); out.write(13); out.write(10); out.write(9); out.write((String)PageContextImpl.proprietaryEvaluate("${item}", class$java$lang$String == null ? (class$java$lang$String = class$("java.lang.String")) : class$java$lang$String, _jspx_page_context, (ProtectedFunctionMapper)null, false)); out.write("\r\n "); } out.write("\r\n </body>\r\n</html> \r\n"); } catch (Throwable t) { if (!(t instanceof SkipPageException)) { if (_jspx_out != null && _jspx_out.getBufferSize() != 0) { _jspx_out.clearBuffer(); } if (_jspx_page_context != null) { _jspx_page_context.handlePageException(t); } } } finally { if (_jspxFactory != null) { _jspxFactory.releasePageContext(_jspx_page_context); } } } // $FF: synthetic method static Class class$(String x0) { try { return Class.forName(x0); } catch (ClassNotFoundException x1) { throw new NoClassDefFoundError(x1.getMessage()); } } }