home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-tomcat-addon-1.4.9-installer.exe / dynamicattrs_jsp.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-05-17  |  5.5 KB  |  120 lines

  1. package org.apache.jsp.jsp2.misc;
  2.  
  3. import java.io.IOException;
  4. import java.util.List;
  5. import java.util.Vector;
  6. import javax.servlet.ServletConfig;
  7. import javax.servlet.ServletContext;
  8. import javax.servlet.ServletException;
  9. import javax.servlet.http.HttpServletRequest;
  10. import javax.servlet.http.HttpServletResponse;
  11. import javax.servlet.http.HttpSession;
  12. import javax.servlet.jsp.JspFactory;
  13. import javax.servlet.jsp.JspWriter;
  14. import javax.servlet.jsp.PageContext;
  15. import javax.servlet.jsp.SkipPageException;
  16. import jsp2.examples.simpletag.EchoAttributesTag;
  17. import org.apache.jasper.runtime.HttpJspBase;
  18. import org.apache.jasper.runtime.JspSourceDependent;
  19.  
  20. public final class dynamicattrs_jsp extends HttpJspBase implements JspSourceDependent {
  21.    private static Vector _jspx_dependants = new Vector(1);
  22.  
  23.    public List getDependants() {
  24.       return _jspx_dependants;
  25.    }
  26.  
  27.    public void _jspService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
  28.       JspFactory _jspxFactory = null;
  29.       PageContext pageContext = null;
  30.       HttpSession session = null;
  31.       ServletContext application = null;
  32.       ServletConfig config = null;
  33.       JspWriter out = null;
  34.       JspWriter _jspx_out = null;
  35.       PageContext _jspx_page_context = null;
  36.  
  37.       try {
  38.          _jspxFactory = JspFactory.getDefaultFactory();
  39.          response.setContentType("text/html");
  40.          pageContext = _jspxFactory.getPageContext(this, request, response, (String)null, true, 8192, true);
  41.          _jspx_page_context = pageContext;
  42.          application = pageContext.getServletContext();
  43.          config = pageContext.getServletConfig();
  44.          session = pageContext.getSession();
  45.          out = pageContext.getOut();
  46.          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\r\n<html>\r\n  <head>\r\n    <title>JSP 2.0 Examples - Dynamic Attributes</title>\r\n  </head>\r\n  <body>\r\n    <h1>JSP 2.0 Examples - Dynamic Attributes</h1>\r\n    <hr>\r\n    <p>This JSP page invokes a custom tag that accepts a dynamic set \r\n    of attributes.  The tag echoes the name and value of all attributes\r\n    passed to it.</p>\r\n    <hr>\r\n    <h2>Invocation 1 (six attributes)</h2>\r\n    <ul>\r\n      ");
  47.          if (!this._jspx_meth_my_echoAttributes_0(pageContext)) {
  48.             out.write("\r\n    </ul>\r\n    <h2>Invocation 2 (zero attributes)</h2>\r\n    <ul>\r\n      ");
  49.             if (this._jspx_meth_my_echoAttributes_1(pageContext)) {
  50.                return;
  51.             }
  52.  
  53.             out.write("\r\n    </ul>\r\n    <h2>Invocation 3 (three attributes)</h2>\r\n    <ul>\r\n      ");
  54.             if (this._jspx_meth_my_echoAttributes_2(pageContext)) {
  55.                return;
  56.             }
  57.  
  58.             out.write("\r\n    </ul>\r\n  </body>\r\n</html>\r\n");
  59.             return;
  60.          }
  61.       } catch (Throwable t) {
  62.          if (!(t instanceof SkipPageException)) {
  63.             if (_jspx_out != null && _jspx_out.getBufferSize() != 0) {
  64.                _jspx_out.clearBuffer();
  65.             }
  66.  
  67.             if (_jspx_page_context != null) {
  68.                _jspx_page_context.handlePageException(t);
  69.                return;
  70.             }
  71.          }
  72.  
  73.          return;
  74.       } finally {
  75.          if (_jspxFactory != null) {
  76.             _jspxFactory.releasePageContext(_jspx_page_context);
  77.          }
  78.  
  79.       }
  80.  
  81.    }
  82.  
  83.    private boolean _jspx_meth_my_echoAttributes_0(PageContext _jspx_page_context) throws Throwable {
  84.       JspWriter out = _jspx_page_context.getOut();
  85.       EchoAttributesTag _jspx_th_my_echoAttributes_0 = new EchoAttributesTag();
  86.       _jspx_th_my_echoAttributes_0.setJspContext(_jspx_page_context);
  87.       _jspx_th_my_echoAttributes_0.setDynamicAttribute((String)null, "x", new String("1"));
  88.       _jspx_th_my_echoAttributes_0.setDynamicAttribute((String)null, "y", new String("2"));
  89.       _jspx_th_my_echoAttributes_0.setDynamicAttribute((String)null, "z", new String("3"));
  90.       _jspx_th_my_echoAttributes_0.setDynamicAttribute((String)null, "r", new String("red"));
  91.       _jspx_th_my_echoAttributes_0.setDynamicAttribute((String)null, "g", new String("green"));
  92.       _jspx_th_my_echoAttributes_0.setDynamicAttribute((String)null, "b", new String("blue"));
  93.       _jspx_th_my_echoAttributes_0.doTag();
  94.       return false;
  95.    }
  96.  
  97.    private boolean _jspx_meth_my_echoAttributes_1(PageContext _jspx_page_context) throws Throwable {
  98.       JspWriter out = _jspx_page_context.getOut();
  99.       EchoAttributesTag _jspx_th_my_echoAttributes_1 = new EchoAttributesTag();
  100.       _jspx_th_my_echoAttributes_1.setJspContext(_jspx_page_context);
  101.       _jspx_th_my_echoAttributes_1.doTag();
  102.       return false;
  103.    }
  104.  
  105.    private boolean _jspx_meth_my_echoAttributes_2(PageContext _jspx_page_context) throws Throwable {
  106.       JspWriter out = _jspx_page_context.getOut();
  107.       EchoAttributesTag _jspx_th_my_echoAttributes_2 = new EchoAttributesTag();
  108.       _jspx_th_my_echoAttributes_2.setJspContext(_jspx_page_context);
  109.       _jspx_th_my_echoAttributes_2.setDynamicAttribute((String)null, "dogName", new String("Scruffy"));
  110.       _jspx_th_my_echoAttributes_2.setDynamicAttribute((String)null, "catName", new String("Fluffy"));
  111.       _jspx_th_my_echoAttributes_2.setDynamicAttribute((String)null, "blowfishName", new String("Puffy"));
  112.       _jspx_th_my_echoAttributes_2.doTag();
  113.       return false;
  114.    }
  115.  
  116.    static {
  117.       _jspx_dependants.add("/WEB-INF/jsp2/jsp2-example-taglib.tld");
  118.    }
  119. }
  120.