supershow_jsp.java

来自「这个例子是实现一个汽泡的效果。 不过用的是Ajax技术哦。」· Java 代码 · 共 124 行

JAVA
124
字号
package org.apache.jsp.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

public final class supershow_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.Vector _jspx_dependants;

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=GBK");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("<link href=\"mycss.css\" type=\"text/css\"  rel=stylesheet/>\r\n");
      out.write("<title>supershow</title>\r\n");
      out.write("<script language=\"javascript\" type=\"text/javascript\">\r\n");
      out.write("var xmlHttp;\r\n");
      out.write("var globalName;\r\n");
      out.write("function createXMLHttp()\r\n");
      out.write("{\r\n");
      out.write("  if(window.XMLHttpRequest)\r\n");
      out.write("    xmlHttp=new XMLHttpRequest();\r\n");
      out.write("  else if(window.ActiveXObject)\r\n");
      out.write("    xmlHttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("function startRequest(name)\r\n");
      out.write("{\r\n");
      out.write("  globalName=name;\r\n");
      out.write("  createXMLHttp();\r\n");
      out.write("  xmlHttp.onreadystatechange=requestHandle;\r\n");
      out.write("  xmlHttp.open(\"GET\",\"/BubbleModule/xml/picture.xml\",true);\r\n");
      out.write("  xmlHttp.send(null);\r\n");
      out.write("}\r\n");
      out.write("function requestHandle()\r\n");
      out.write("{\r\n");
      out.write("  if(xmlHttp.readyState==4)\r\n");
      out.write("  {\r\n");
      out.write("    //获得所有的picture标签\r\n");
      out.write("    var pictures=xmlHttp.responseXML.getElementsByTagName(\"picture\");\r\n");
      out.write("\r\n");
      out.write("    for(var i=0;i<pictures.length;i++)\r\n");
      out.write("    {\r\n");
      out.write("      //获得单个picture\r\n");
      out.write("      var pic=pictures[i];\r\n");
      out.write("      //获得picture的子节点id的文本\r\n");
      out.write("      var picName=pic.getElementsByTagName(\"name\")[0].firstChild.nodeValue;\r\n");
      out.write("      //获得picture的子节点directory的文本\r\n");
      out.write("      var picDir=pic.getElementsByTagName(\"directory\")[0].firstChild.nodeValue;\r\n");
      out.write("      //获得提出请求的标签\r\n");
      out.write("      var tagImage = document.getElementById(globalName);\r\n");
      out.write("      //判断获得的文本是否和提出请求的标签的名称相同\r\n");
      out.write("      if(picName==globalName)\r\n");
      out.write("          tagImage.src=picDir;\r\n");
      out.write("       }\r\n");
      out.write("      globalName=\"\";\r\n");
      out.write("      document.getElementById(\"im\").style.zIndex=100;\r\n");
      out.write("      document.getElementById(\"im\").style.display=\"block\";\r\n");
      out.write("  }\r\n");
      out.write("}\r\n");
      out.write("</script>\r\n");
      out.write("<link href=\"../js/mycss.css\" type=text/css rel=stylesheet>\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      out.write("<h2>Super show</h2>\r\n");
      out.write("<hr>\r\n");
      out.write("<table width=\"162\" border=\"0\" cellspacing=\"5\" cellpadding=\"0\">\r\n");
      out.write("\r\n");
      out.write("   <tr>\r\n");
      out.write("  <td>\r\n");
      out.write(" <a  href=\"#\" class=tipS  onMouseOver=\"startRequest('Tab11')\" onmouseout=\"im.style.display='none';\">\r\n");
      out.write("        <img style=\"cursor:hand\" src=\"../image/Tab11.jpg\" width=\"56\" height=\"65\" alt=\"\" />\r\n");
      out.write("        <div id=\"im\" class=\"divImg\"><img id=\"Tab11\"style=\"cursor:hand\" alt=\"\" src=\"\" width=\"100\" height=\"120\"> </span></a>\r\n");
      out.write("  </td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?