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

  1. package org.apache.jsp.sessions;
  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 org.apache.jasper.runtime.HttpJspBase;
  17. import org.apache.jasper.runtime.JspRuntimeLibrary;
  18. import org.apache.jasper.runtime.JspSourceDependent;
  19. import sessions.DummyCart;
  20. import util.HTMLFilter;
  21.  
  22. public final class carts_jsp extends HttpJspBase implements JspSourceDependent {
  23.    private static Vector _jspx_dependants = new Vector(1);
  24.  
  25.    public List getDependants() {
  26.       return _jspx_dependants;
  27.    }
  28.  
  29.    public void _jspService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
  30.       JspFactory _jspxFactory = null;
  31.       PageContext pageContext = null;
  32.       HttpSession session = null;
  33.       ServletContext application = null;
  34.       ServletConfig config = null;
  35.       JspWriter out = null;
  36.       JspWriter _jspx_out = null;
  37.       PageContext _jspx_page_context = null;
  38.  
  39.       try {
  40.          _jspxFactory = JspFactory.getDefaultFactory();
  41.          response.setContentType("text/html");
  42.          pageContext = _jspxFactory.getPageContext(this, request, response, (String)null, true, 8192, true);
  43.          _jspx_page_context = pageContext;
  44.          application = pageContext.getServletContext();
  45.          config = pageContext.getServletConfig();
  46.          session = pageContext.getSession();
  47.          out = pageContext.getOut();
  48.          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");
  49.          DummyCart cart = null;
  50.          synchronized(session) {
  51.             cart = (DummyCart)_jspx_page_context.getAttribute("cart", 3);
  52.             if (cart == null) {
  53.                cart = new DummyCart();
  54.                _jspx_page_context.setAttribute("cart", cart, 3);
  55.             }
  56.          }
  57.  
  58.          out.write("\r\n\r\n");
  59.          JspRuntimeLibrary.introspect(pageContext.findAttribute("cart"), request);
  60.          out.write(13);
  61.          out.write(10);
  62.          cart.processRequest(request);
  63.          out.write("\r\n\r\n\r\n<FONT size = 5 COLOR=\"#CC0000\">\r\n<br> You have the following items in your cart:\r\n<ol>\r\n");
  64.          String[] items = cart.getItems();
  65.  
  66.          for(int i = 0; i < items.length; ++i) {
  67.             out.write("\r\n<li> ");
  68.             out.print(HTMLFilter.filter(items[i]));
  69.             out.write(32);
  70.             out.write(13);
  71.             out.write(10);
  72.          }
  73.  
  74.          out.write("\r\n</ol>\r\n\r\n</FONT>\r\n\r\n<hr>\r\n");
  75.          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<head>\r\n    <title>carts</title>\r\n</head>\r\n\r\n <body bgcolor=\"white\">\r\n<font size = 5 color=\"#CC0000\">\r\n\r\n<form type=POST action=carts.jsp>\r\n<BR>\r\nPlease enter item to add or remove:\r\n<br>\r\nAdd Item:\r\n\r\n<SELECT NAME=\"item\">\r\n<OPTION>Beavis & Butt-head Video collection\r\n<OPTION>X-files movie\r\n<OPTION>Twin peaks tapes\r\n<OPTION>NIN CD\r\n<OPTION>JSP Book\r\n<OPTION>Concert tickets\r\n<OPTION>Love life\r\n<OPTION>Switch blade\r\n");
  76.          out.write("<OPTION>Rex, Rugs & Rock n' Roll\r\n</SELECT>\r\n\r\n\r\n<br> <br>\r\n<INPUT TYPE=submit name=\"submit\" value=\"add\">\r\n<INPUT TYPE=submit name=\"submit\" value=\"remove\">\r\n\r\n</form>\r\n       \r\n</FONT>\r\n</body>\r\n</html>\r\n");
  77.          out.write("\r\n</html>\r\n");
  78.       } catch (Throwable t) {
  79.          if (!(t instanceof SkipPageException)) {
  80.             if (_jspx_out != null && _jspx_out.getBufferSize() != 0) {
  81.                _jspx_out.clearBuffer();
  82.             }
  83.  
  84.             if (_jspx_page_context != null) {
  85.                _jspx_page_context.handlePageException(t);
  86.             }
  87.          }
  88.       } finally {
  89.          if (_jspxFactory != null) {
  90.             _jspxFactory.releasePageContext(_jspx_page_context);
  91.          }
  92.  
  93.       }
  94.  
  95.    }
  96.  
  97.    static {
  98.       _jspx_dependants.add("/sessions/carts.html");
  99.    }
  100. }
  101.