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 / jspattribute_jsp.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-05-17  |  6.1 KB  |  109 lines

  1. package org.apache.jsp.jsp2.jspattribute;
  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.ServletRequest;
  10. import javax.servlet.http.HttpServletRequest;
  11. import javax.servlet.http.HttpServletResponse;
  12. import javax.servlet.http.HttpSession;
  13. import javax.servlet.jsp.JspFactory;
  14. import javax.servlet.jsp.JspWriter;
  15. import javax.servlet.jsp.PageContext;
  16. import javax.servlet.jsp.SkipPageException;
  17. import javax.servlet.jsp.tagext.BodyContent;
  18. import jsp2.examples.FooBean;
  19. import jsp2.examples.simpletag.HelloWorldSimpleTag;
  20. import org.apache.jasper.runtime.HttpJspBase;
  21. import org.apache.jasper.runtime.JspRuntimeLibrary;
  22. import org.apache.jasper.runtime.JspSourceDependent;
  23. import org.apache.jasper.runtime.PageContextImpl;
  24. import org.apache.jasper.runtime.ProtectedFunctionMapper;
  25.  
  26. public final class jspattribute_jsp extends HttpJspBase implements JspSourceDependent {
  27.    private static Vector _jspx_dependants = new Vector(1);
  28.    // $FF: synthetic field
  29.    static Class class$java$lang$String;
  30.  
  31.    public List getDependants() {
  32.       return _jspx_dependants;
  33.    }
  34.  
  35.    public void _jspService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
  36.       JspFactory _jspxFactory = null;
  37.       PageContext pageContext = null;
  38.       HttpSession session = null;
  39.       ServletContext application = null;
  40.       ServletConfig config = null;
  41.       JspWriter out = null;
  42.       JspWriter _jspx_out = null;
  43.       PageContext _jspx_page_context = null;
  44.  
  45.       try {
  46.          _jspxFactory = JspFactory.getDefaultFactory();
  47.          response.setContentType("text/html");
  48.          pageContext = _jspxFactory.getPageContext(this, request, response, (String)null, true, 8192, true);
  49.          _jspx_page_context = pageContext;
  50.          application = pageContext.getServletContext();
  51.          config = pageContext.getServletConfig();
  52.          session = pageContext.getSession();
  53.          out = pageContext.getOut();
  54.          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\r\n<html>\r\n  <head>\r\n    <title>JSP 2.0 Examples - jsp:attribute and jsp:body</title>\r\n  </head>\r\n  <body>\r\n    <h1>JSP 2.0 Examples - jsp:attribute and jsp:body</h1>\r\n    <hr>\r\n    <p>The new <jsp:attribute> and <jsp:body> \r\n    standard actions can be used to specify the value of any standard\r\n    action or custom action attribute.</p>\r\n    <p>This example uses the <jsp:attribute>\r\n    standard action to use the output of a custom action invocation\r\n");
  55.          out.write("    (one that simply outputs \"Hello, World!\") to set the value of a\r\n    bean property.  This would normally require an intermediary\r\n    step, such as using JSTL's <c:set> action.</p>\r\n    <br>\r\n    ");
  56.          FooBean foo = null;
  57.          synchronized(pageContext) {
  58.             foo = (FooBean)_jspx_page_context.getAttribute("foo", 1);
  59.             if (foo == null) {
  60.                foo = new FooBean();
  61.                _jspx_page_context.setAttribute("foo", foo, 1);
  62.                out.write("\r\n      Bean created!  Setting foo.bar...<br>\r\n      ");
  63.                JspWriter var29 = _jspx_page_context.pushBody();
  64.                HelloWorldSimpleTag _jspx_th_my_helloWorld_0 = new HelloWorldSimpleTag();
  65.                _jspx_th_my_helloWorld_0.setJspContext(_jspx_page_context);
  66.                _jspx_th_my_helloWorld_0.doTag();
  67.                String _jspx_temp0 = ((BodyContent)var29).getString();
  68.                out = _jspx_page_context.popBody();
  69.                JspRuntimeLibrary.introspecthelper(_jspx_page_context.findAttribute("foo"), "bar", _jspx_temp0, (ServletRequest)null, (String)null, false);
  70.                out.write("\r\n    ");
  71.             }
  72.          }
  73.  
  74.          out.write("\r\n    <br>\r\n    Result: ");
  75.          out.write((String)PageContextImpl.proprietaryEvaluate("${foo.bar}", class$java$lang$String == null ? (class$java$lang$String = class$("java.lang.String")) : class$java$lang$String, pageContext, (ProtectedFunctionMapper)null, false));
  76.          out.write("\r\n  </body>\r\n</html>\r\n");
  77.       } catch (Throwable t) {
  78.          if (!(t instanceof SkipPageException)) {
  79.             if (_jspx_out != null && _jspx_out.getBufferSize() != 0) {
  80.                _jspx_out.clearBuffer();
  81.             }
  82.  
  83.             if (_jspx_page_context != null) {
  84.                _jspx_page_context.handlePageException(t);
  85.             }
  86.          }
  87.       } finally {
  88.          if (_jspxFactory != null) {
  89.             _jspxFactory.releasePageContext(_jspx_page_context);
  90.          }
  91.  
  92.       }
  93.  
  94.    }
  95.  
  96.    // $FF: synthetic method
  97.    static Class class$(String x0) {
  98.       try {
  99.          return Class.forName(x0);
  100.       } catch (ClassNotFoundException x1) {
  101.          throw new NoClassDefFoundError(x1.getMessage());
  102.       }
  103.    }
  104.  
  105.    static {
  106.       _jspx_dependants.add("/WEB-INF/jsp2/jsp2-example-taglib.tld");
  107.    }
  108. }
  109.