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

  1. package org.apache.jsp.error;
  2.  
  3. import error.Smart;
  4. import java.io.IOException;
  5. import java.util.List;
  6. import java.util.Vector;
  7. import javax.servlet.ServletConfig;
  8. import javax.servlet.ServletContext;
  9. import javax.servlet.ServletException;
  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 org.apache.jasper.runtime.HttpJspBase;
  18. import org.apache.jasper.runtime.JspSourceDependent;
  19.  
  20. public final class err_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, "errorpge.jsp", 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("<html>\r\n<!--\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<body bgcolor=\"lightblue\">\r\n\r\n\t\r\n\t");
  47.          Smart foo = null;
  48.          synchronized(request) {
  49.             foo = (Smart)_jspx_page_context.getAttribute("foo", 2);
  50.             if (foo == null) {
  51.                foo = new Smart();
  52.                _jspx_page_context.setAttribute("foo", foo, 2);
  53.             }
  54.          }
  55.  
  56.          out.write(13);
  57.          out.write(10);
  58.          out.write(9);
  59.          String name = null;
  60.          if (request.getParameter("name") == null) {
  61.             out.write(13);
  62.             out.write(10);
  63.             out.write(9);
  64.             out.write("<html>\r\n<!--\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<body bgcolor=\"white\">\r\n\r\n<h1> This example uses <b>errorpage</b> directive </h1>\r\n<br>\r\n<h3> Select my favourite car.</h3>\r\n<form method=get action=err.jsp>\r\n<!-- <br> Make a guess: -->\r\n<SELECT NAME=\"name\" SIZE=5>\r\n<OPTION VALUE=\"integra\"> Acura Integra <BR>\r\n<OPTION VALUE=\"bmw328i\"> BMW 328I <BR>\r\n<OPTION VALUE=\"z3\"> BMW Z3 <BR>\r\n<OPTION VALUE=\"infiniti\"> InfinitiQ3 <BR>\r\n<OPTION VALUE=\"audi\"> Audi A8 <BR>\r\n");
  65.             out.write("</SELECT>\r\n<br> <INPUT TYPE=submit name=submit Value=\"Submit\">\r\n</form>\r\n\r\n</body>\r\n</html>\r\n");
  66.             out.write(13);
  67.             out.write(10);
  68.             out.write(9);
  69.          } else {
  70.             foo.setName(request.getParameter("name"));
  71.             if (foo.getName().equalsIgnoreCase("integra")) {
  72.                name = "acura";
  73.             }
  74.  
  75.             if (name.equalsIgnoreCase("acura")) {
  76.                out.write("\r\n\r\n\t<H1> Yes!!! <a href=\"http://www.acura.com\">Acura</a> is my favorite car.\r\n\r\n\t");
  77.             }
  78.          }
  79.  
  80.          out.write("\t\r\n</body>\r\n</html>\r\n\r\n");
  81.       } catch (Throwable t) {
  82.          if (!(t instanceof SkipPageException)) {
  83.             if (_jspx_out != null && _jspx_out.getBufferSize() != 0) {
  84.                _jspx_out.clearBuffer();
  85.             }
  86.  
  87.             if (_jspx_page_context != null) {
  88.                _jspx_page_context.handlePageException(t);
  89.             }
  90.          }
  91.       } finally {
  92.          if (_jspxFactory != null) {
  93.             _jspxFactory.releasePageContext(_jspx_page_context);
  94.          }
  95.  
  96.       }
  97.  
  98.    }
  99.  
  100.    static {
  101.       _jspx_dependants.add("/error/error.html");
  102.    }
  103. }
  104.