001    package jsp.sessions;
002    
003    import javax.servlet.*;
004    import javax.servlet.http.*;
005    import javax.servlet.jsp.*;
006    
007    public final class carts_jsp extends org.apache.jasper.runtime.HttpJspBase
008        implements org.apache.jasper.runtime.JspSourceDependent {
009    
010      private static java.util.List _jspx_dependants;
011    
012      static {
013        _jspx_dependants = new java.util.ArrayList(1);
014        _jspx_dependants.add("/sessions/carts.html");
015      }
016    
017      public Object getDependants() {
018        return _jspx_dependants;
019      }
020    
021      public void _jspService(HttpServletRequest request, HttpServletResponse response)
022            throws java.io.IOException, ServletException {
023    
024        JspFactory _jspxFactory = null;
025        PageContext pageContext = null;
026        HttpSession session = null;
027        ServletContext application = null;
028        ServletConfig config = null;
029        JspWriter out = null;
030        Object page = this;
031        JspWriter _jspx_out = null;
032        PageContext _jspx_page_context = null;
033    
034    
035        try {
036          _jspxFactory = JspFactory.getDefaultFactory();
037          response.setContentType("text/html");
038          pageContext = _jspxFactory.getPageContext(this, request, response,
039                            null, true, 8192, true);
040          _jspx_page_context = pageContext;
041          application = pageContext.getServletContext();
042          config = pageContext.getServletConfig();
043          session = pageContext.getSession();
044          out = pageContext.getOut();
045          _jspx_out = out;
046    
047          out.write("<html>\n<!--\n Licensed to the Apache Software Foundation (ASF) under one or more\n  contributor license agreements.  See the NOTICE file distributed with\n  this work for additional information regarding copyright ownership.\n  The ASF licenses this file to You under the Apache License, Version 2.0\n  (the \"License\"); you may not use this file except in compliance with\n  the License.  You may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n\n");
048          sessions.DummyCart cart = null;
049          synchronized (session) {
050            cart = (sessions.DummyCart) _jspx_page_context.getAttribute("cart", PageContext.SESSION_SCOPE);
051            if (cart == null){
052              cart = new sessions.DummyCart();
053              _jspx_page_context.setAttribute("cart", cart, PageContext.SESSION_SCOPE);
054            }
055          }
056          out.write('\n');
057          out.write('\n');
058          org.apache.jasper.runtime.JspRuntimeLibrary.introspect(_jspx_page_context.findAttribute("cart"), request);
059          out.write('\n');
060    
061            cart.processRequest(request);
062    
063          out.write("\n\n\n<FONT size = 5 COLOR=\"#CC0000\">\n<br> You have the following items in your cart:\n<ol>\n");
064     
065            String[] items = cart.getItems();
066            for (int i=0; i<items.length; i++) {
067    
068          out.write("\n<li> ");
069     out.print(util.HTMLFilter.filter(items[i])); 
070          out.write(' ');
071          out.write('\n');
072    
073            }
074    
075          out.write("\n</ol>\n\n</FONT>\n\n<hr>\n");
076          out.write("<html>\n<!--\n Licensed to the Apache Software Foundation (ASF) under one or more\n  contributor license agreements.  See the NOTICE file distributed with\n  this work for additional information regarding copyright ownership.\n  The ASF licenses this file to You under the Apache License, Version 2.0\n  (the \"License\"); you may not use this file except in compliance with\n  the License.  You may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n\n<head>\n    <title>carts</title>\n</head>\n\n <body bgcolor=\"white\">\n<font size = 5 color=\"#CC0000\">\n\n<form type=POST action=carts.jsp>\n<BR>\nPlease enter item to add or remove:\n<br>\nAdd Item:\n\n<SELECT NAME=\"item\">\n<OPTION>Beavis & Butt-head Video collection\n");
077          out.write("<OPTION>X-files movie\n<OPTION>Twin peaks tapes\n<OPTION>NIN CD\n<OPTION>JSP Book\n<OPTION>Concert tickets\n<OPTION>Love life\n<OPTION>Switch blade\n<OPTION>Rex, Rugs & Rock n' Roll\n</SELECT>\n\n\n<br> <br>\n<INPUT TYPE=submit name=\"submit\" value=\"add\">\n<INPUT TYPE=submit name=\"submit\" value=\"remove\">\n\n</form>\n       \n</FONT>\n</body>\n</html>\n");
078          out.write("\n</html>\n");
079        } catch (Throwable t) {
080          if (!(t instanceof SkipPageException)){
081            out = _jspx_out;
082            if (out != null && out.getBufferSize() != 0)
083              out.clearBuffer();
084            if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
085          }
086        } finally {
087          if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
088        }
089      }
090    }