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 / basic_jspx$basic_jspxHelper.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-05-17  |  4.0 KB  |  94 lines

  1. package org.apache.jsp.jsp2.jspx;
  2.  
  3. import java.io.Writer;
  4. import java.util.Date;
  5. import javax.servlet.ServletContext;
  6. import javax.servlet.http.HttpServletRequest;
  7. import javax.servlet.http.HttpSession;
  8. import javax.servlet.jsp.JspContext;
  9. import javax.servlet.jsp.JspException;
  10. import javax.servlet.jsp.JspWriter;
  11. import javax.servlet.jsp.SkipPageException;
  12. import javax.servlet.jsp.tagext.JspTag;
  13. import org.apache.jasper.runtime.JspFragmentHelper;
  14.  
  15. class basic_jspx$basic_jspxHelper extends JspFragmentHelper {
  16.    private JspTag _jspx_parent;
  17.    private int[] _jspx_push_body_count;
  18.    // $FF: synthetic field
  19.    private final basic_jspx this$0;
  20.  
  21.    public basic_jspx$basic_jspxHelper(basic_jspx this$0, int discriminator, JspContext jspContext, JspTag _jspx_parent, int[] _jspx_push_body_count) {
  22.       super(discriminator, jspContext, _jspx_parent);
  23.       this.this$0 = this$0;
  24.       this._jspx_parent = _jspx_parent;
  25.       this._jspx_push_body_count = _jspx_push_body_count;
  26.    }
  27.  
  28.    public boolean invoke0(JspWriter out) throws Throwable {
  29.       HttpSession session = this._jspx_page_context.getSession();
  30.       ServletContext application = this._jspx_page_context.getServletContext();
  31.       HttpServletRequest request = (HttpServletRequest)this._jspx_page_context.getRequest();
  32.       out.write("<head>");
  33.       out.write("<title>");
  34.       out.write("JSPX - XHTML Basic Example");
  35.       out.write("</title>");
  36.       out.write("</head>");
  37.       out.write("<body>");
  38.       out.write("<h1>");
  39.       out.write("JSPX - XHTML Basic Example");
  40.       out.write("</h1>");
  41.       out.write("<hr/>");
  42.       out.write("\n    This example illustrates how to use JSPX to produce an XHTML basic\n    document suitable for use with mobile phones, televisions, \n    PDAs, vending machines, pagers, car navigation systems,\n    mobile game machines, digital book readers, smart watches, etc.\n    ");
  43.       out.write("<p/>");
  44.       out.write("\n    JSPX lets you create dynamic documents in a pure XML syntax compatible\n    with existing XML tools.  The XML syntax in JSP 1.2 was awkward and\n    required <jsp:root> to be the root element of the document.\n    This is no longer the case in JSP 2.0.\n    ");
  45.       out.write("<p/>");
  46.       out.write("\n    This particular example uses a tag file to produce the DOCTYPE and\n    namespace declarations to make the output of this page a valid XHTML\n    Basic document.\n    ");
  47.       out.write("<p/>");
  48.       out.write("\n    Just to proove this is live, here's some dynamic content:\n    ");
  49.       Date now = null;
  50.       synchronized(this._jspx_page_context) {
  51.          now = (Date)this._jspx_page_context.getAttribute("now", 1);
  52.          if (now == null) {
  53.             now = new Date();
  54.             this._jspx_page_context.setAttribute("now", now, 1);
  55.          }
  56.       }
  57.  
  58.       if (basic_jspx.access$000(this.this$0, this._jspx_parent, this._jspx_page_context)) {
  59.          return true;
  60.       } else {
  61.          out.write("</body>");
  62.          return false;
  63.       }
  64.    }
  65.  
  66.    public void invoke(Writer writer) throws JspException {
  67.       JspWriter out = null;
  68.       if (writer != null) {
  69.          out = this.jspContext.pushBody(writer);
  70.       } else {
  71.          out = this.jspContext.getOut();
  72.       }
  73.  
  74.       try {
  75.          switch (this.discriminator) {
  76.             case 0:
  77.                this.invoke0(out);
  78.          }
  79.       } catch (Throwable e) {
  80.          if (e instanceof SkipPageException) {
  81.             throw (SkipPageException)e;
  82.          }
  83.  
  84.          throw new JspException(e);
  85.       } finally {
  86.          if (writer != null) {
  87.             this.jspContext.popBody();
  88.          }
  89.  
  90.       }
  91.  
  92.    }
  93. }
  94.