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

  1. package org.apache.jsp.cal;
  2.  
  3. import cal.Entry;
  4. import cal.TableBean;
  5. import java.io.IOException;
  6. import java.util.List;
  7. import java.util.Vector;
  8. import javax.servlet.ServletConfig;
  9. import javax.servlet.ServletContext;
  10. import javax.servlet.ServletException;
  11. import javax.servlet.http.HttpServletRequest;
  12. import javax.servlet.http.HttpServletResponse;
  13. import javax.servlet.http.HttpSession;
  14. import javax.servlet.jsp.JspFactory;
  15. import javax.servlet.jsp.JspWriter;
  16. import javax.servlet.jsp.PageContext;
  17. import javax.servlet.jsp.SkipPageException;
  18. import org.apache.jasper.runtime.HttpJspBase;
  19. import org.apache.jasper.runtime.JspSourceDependent;
  20. import util.HTMLFilter;
  21.  
  22. public final class cal1_jsp extends HttpJspBase implements JspSourceDependent {
  23.    private static Vector _jspx_dependants;
  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<HEAD><TITLE> \r\n\tCalendar: A JSP APPLICATION\r\n</TITLE></HEAD>\r\n\r\n\r\n<BODY BGCOLOR=\"white\">\r\n\r\n\r\n");
  49.          TableBean table = null;
  50.          synchronized(session) {
  51.             table = (TableBean)_jspx_page_context.getAttribute("table", 3);
  52.             if (table == null) {
  53.                table = new TableBean();
  54.                _jspx_page_context.setAttribute("table", table, 3);
  55.             }
  56.          }
  57.  
  58.          out.write("\r\n\r\n");
  59.          table.processRequest(request);
  60.          if (table.getProcessError()) {
  61.             out.write("\r\n<font size=5>\r\n\tYou must enter your name and email address correctly.\r\n</font>\r\n");
  62.          } else {
  63.             out.write("\r\n\r\n<!-- html table goes here -->\r\n<CENTER>\r\n<TABLE WIDTH=60% BGCOLOR=yellow CELLPADDING=15>\r\n<TR>\r\n<TD ALIGN=CENTER> <A HREF=cal1.jsp?date=prev> prev </A>\r\n<TD ALIGN=CENTER> Calendar:");
  64.             out.print(table.getDate());
  65.             out.write("</TD>\r\n<TD ALIGN=CENTER> <A HREF=cal1.jsp?date=next> next </A>\r\n</TR>\r\n</TABLE>\r\n\r\n<!-- the main table -->\r\n<TABLE WIDTH=60% BGCOLOR=lightblue BORDER=1 CELLPADDING=10>\r\n<TR>\r\n<TH> Time </TH>\r\n<TH> Appointment </TH>\r\n</TR>\r\n<FORM METHOD=POST ACTION=cal1.jsp>\r\n");
  66.  
  67.             for(int i = 0; i < table.getEntries().getRows(); ++i) {
  68.                Entry entr = table.getEntries().getEntry(i);
  69.                out.write("\r\n\t<TR>\r\n\t<TD> \r\n\t<A HREF=cal2.jsp?time=");
  70.                out.print(entr.getHour());
  71.                out.write(">\r\n\t\t");
  72.                out.print(entr.getHour());
  73.                out.write(" </A>\r\n\t</TD>\r\n\t<TD BGCOLOR=");
  74.                out.print(entr.getColor());
  75.                out.write(">\r\n\t");
  76.                out.print(HTMLFilter.filter(entr.getDescription()));
  77.                out.write("\r\n\t</TD> \r\n\t</TR>\r\n");
  78.             }
  79.  
  80.             out.write("\r\n</FORM>\r\n</TABLE>\r\n<BR>\r\n\r\n<!-- footer -->\r\n<TABLE WIDTH=60% BGCOLOR=yellow CELLPADDING=15>\r\n<TR>\r\n<TD ALIGN=CENTER>  ");
  81.             out.print(HTMLFilter.filter(table.getName()));
  82.             out.write(" : \r\n\t\t     ");
  83.             out.print(HTMLFilter.filter(table.getEmail()));
  84.             out.write(" </TD>\r\n</TR>\r\n</TABLE>\r\n</CENTER>\r\n\r\n");
  85.          }
  86.  
  87.          out.write("\r\n\r\n\r\n</BODY>\r\n</HTML>\r\n\r\n\r\n\r\n\r\n");
  88.       } catch (Throwable t) {
  89.          if (!(t instanceof SkipPageException)) {
  90.             if (_jspx_out != null && _jspx_out.getBufferSize() != 0) {
  91.                _jspx_out.clearBuffer();
  92.             }
  93.  
  94.             if (_jspx_page_context != null) {
  95.                _jspx_page_context.handlePageException(t);
  96.             }
  97.          }
  98.       } finally {
  99.          if (_jspxFactory != null) {
  100.             _jspxFactory.releasePageContext(_jspx_page_context);
  101.          }
  102.  
  103.       }
  104.  
  105.    }
  106. }
  107.