upload_jsp.java

来自「北航继续教育学院论坛的源码,演示网址www.buaaforum.com,采用st」· Java 代码 · 共 639 行 · 第 1/3 页

JAVA
639
字号
package org.apache.jsp.WEB_002dINF.app;

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

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

  private static java.util.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(5);
    _jspx_dependants.add("/WEB-INF/app/comm/taglibs.jsp");
    _jspx_dependants.add("/WEB-INF/tld/struts-bean.tld");
    _jspx_dependants.add("/WEB-INF/tld/struts-html.tld");
    _jspx_dependants.add("/WEB-INF/tld/struts-logic.tld");
    _jspx_dependants.add("/WEB-INF/tld/yhbbs.tld");
  }

  private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_html;
  private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_form_method_enctype_action;
  private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_bean_write_name_nobody;
  private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_logic_greaterThan_value_name;
  private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_errors_nobody;
  private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_logic_lessThan_value_name;
  private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_logic_iterate_name_indexId_id;
  private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_bean_write_property_name_nobody;

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

  public void _jspInit() {
    _jspx_tagPool_html_html = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _jspx_tagPool_html_form_method_enctype_action = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _jspx_tagPool_bean_write_name_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _jspx_tagPool_logic_greaterThan_value_name = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _jspx_tagPool_html_errors_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _jspx_tagPool_logic_lessThan_value_name = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _jspx_tagPool_logic_iterate_name_indexId_id = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _jspx_tagPool_bean_write_property_name_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
  }

  public void _jspDestroy() {
    _jspx_tagPool_html_html.release();
    _jspx_tagPool_html_form_method_enctype_action.release();
    _jspx_tagPool_bean_write_name_nobody.release();
    _jspx_tagPool_logic_greaterThan_value_name.release();
    _jspx_tagPool_html_errors_nobody.release();
    _jspx_tagPool_logic_lessThan_value_name.release();
    _jspx_tagPool_logic_iterate_name_indexId_id.release();
    _jspx_tagPool_bean_write_property_name_nobody.release();
  }

  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=UTF-8");
      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');
      out.write('\n');
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<link href=\"webapp/comm/css/yhbbs1.css\" type=\"text/css\" rel=\"stylesheet\">");
      out.write('\r');
      out.write('\n');
      //  html:html
      org.apache.struts.taglib.html.HtmlTag _jspx_th_html_html_0 = (org.apache.struts.taglib.html.HtmlTag) _jspx_tagPool_html_html.get(org.apache.struts.taglib.html.HtmlTag.class);
      _jspx_th_html_html_0.setPageContext(_jspx_page_context);
      _jspx_th_html_html_0.setParent(null);
      int _jspx_eval_html_html_0 = _jspx_th_html_html_0.doStartTag();
      if (_jspx_eval_html_html_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
        do {
          out.write("\r\n");
          out.write("<head>\r\n");
          out.write("<title>上传附件</title>\r\n");
          out.write("<script language=\"JavaScript\">\r\n");
          out.write("  var vbDOMtype = '';\r\n");
          out.write("  if (document.getElementById) {\r\n");
          out.write("    vbDOMtype = \"std\";\r\n");
          out.write("  }\r\n");
          out.write("  else if (document.all) {\r\n");
          out.write("    vbDOMtype = \"ie4\";\r\n");
          out.write("  }\r\n");
          out.write("  else if (document.layers){\r\n");
          out.write("    vbDOMtype = \"ns4\";\r\n");
          out.write("  }\r\n");
          out.write("  var openner=window.opener==null?parent:window.opener;\r\n");
          out.write("  \r\n");
          out.write("  switch (vbDOMtype) {\r\n");
          out.write("    case \"std\":{\r\n");
          out.write("      var attachlist = openner.document.getElementById(\"attachList\");\r\n");
          out.write("    }\r\n");
          out.write("    break;\r\n");
          out.write("    case \"ie4\": {\r\n");
          out.write("      var attachlist = openner.document.all[\"attachList\"];\r\n");
          out.write("    }\r\n");
          out.write("  }\r\n");
          out.write("  \r\n");
          out.write("  function verify_upload(formobj) {\r\n");
          out.write("    var haveupload = false;\r\n");
          out.write("    for (var i=0; i < formobj.elements.length; i++) {\r\n");
          out.write("      var elm = formobj.elements[i];\r\n");
          out.write("      if (elm.type == 'file'){\r\n");
          out.write("        if (elm.value != \"\"){\r\n");
          out.write("          haveupload = true;\r\n");
          out.write("        }\r\n");
          out.write("      }\r\n");
          out.write("    }\r\n");
          out.write("    if (haveupload){\r\n");
          out.write("      toggle_display();\r\n");
          out.write("      formobj.submit();\r\n");
          out.write("      formobj.upload.disabled=true;\r\n");
          out.write("    } else {\r\n");
          out.write("      alert(\"Please select your file for upload.\");\r\n");
          out.write("    }\r\n");
          out.write("    return false;\r\n");
          out.write("  }\r\n");
          out.write("  \r\n");
          out.write("  function toggle_display() {\r\n");
          out.write("    var obj=uploading;\r\n");
          out.write("    if (obj.style.display == \"none\") {\r\n");
          out.write("      obj.style.display = \"\";\r\n");
          out.write("    } else {\r\n");
          out.write("      obj.style.display = \"none\";\r\n");
          out.write("    }\r\n");
          out.write("  }\r\n");
          out.write("</script>\r\n");

   int curNum = Integer.parseInt(request.getAttribute("curNum").toString());

          out.write("\r\n");
          out.write("</head>\r\n");
          out.write("<body>\r\n");
          //  html:form
          org.apache.struts.taglib.html.FormTag _jspx_th_html_form_0 = (org.apache.struts.taglib.html.FormTag) _jspx_tagPool_html_form_method_enctype_action.get(org.apache.struts.taglib.html.FormTag.class);
          _jspx_th_html_form_0.setPageContext(_jspx_page_context);
          _jspx_th_html_form_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_html_0);
          _jspx_th_html_form_0.setAction("/UpLoad.htm");
          _jspx_th_html_form_0.setEnctype("multipart/form-data");
          _jspx_th_html_form_0.setMethod("post");
          int _jspx_eval_html_form_0 = _jspx_th_html_form_0.doStartTag();
          if (_jspx_eval_html_form_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
            do {
              out.write("\r\n");
              out.write("<input type=\"hidden\" name=\"artId\" value=\"");
              if (_jspx_meth_bean_write_0(_jspx_th_html_form_0, _jspx_page_context))
                return;
              out.write("\">\r\n");
              out.write("<input type=\"hidden\" name=\"action\" value=\"");
              if (_jspx_meth_bean_write_1(_jspx_th_html_form_0, _jspx_page_context))
                return;
              out.write("\">\r\n");
              out.write("<table class=\"tab1\" cellpadding=0 cellspacing=0 border=0 align=center width=\"80%\">\r\n");
              out.write(" <tr class=\"tr_1\"><td align=center colspan=2 class=\"tab_c\" height=\"24px\"><b>管理附件</b></td></tr>\r\n");
              out.write(" <tr class=\"tr_1\"><td align=center colspan=2 height=\"24px\"><b>你上传附件空间剩余:");
              if (_jspx_meth_bean_write_2(_jspx_th_html_form_0, _jspx_page_context))
                return;
              out.write("&nbsp;K</b></td></tr>\r\n");
              out.write(" ");
              //  logic:greaterThan
              org.apache.struts.taglib.logic.GreaterThanTag _jspx_th_logic_greaterThan_0 = (org.apache.struts.taglib.logic.GreaterThanTag) _jspx_tagPool_logic_greaterThan_value_name.get(org.apache.struts.taglib.logic.GreaterThanTag.class);
              _jspx_th_logic_greaterThan_0.setPageContext(_jspx_page_context);
              _jspx_th_logic_greaterThan_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_form_0);
              _jspx_th_logic_greaterThan_0.setName("fleave");
              _jspx_th_logic_greaterThan_0.setValue("0");
              int _jspx_eval_logic_greaterThan_0 = _jspx_th_logic_greaterThan_0.doStartTag();
              if (_jspx_eval_logic_greaterThan_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                do {
                  out.write("\r\n");
                  out.write(" <tr><td width=40% class=\"td_t\"><center><font color=\"red\">");
                  if (_jspx_meth_html_errors_0(_jspx_th_logic_greaterThan_0, _jspx_page_context))
                    return;
                  out.write("</font></center>\r\n");
                  out.write("      <b>上传附件或图片</b><br>最大允许<B>1024K</B>\r\n");
                  out.write("     </td>\r\n");
                  out.write("     <td class=\"td_lt\">\r\n");
                  out.write("\t ");
for(int i=0;i<curNum;i++) {
                  out.write("\r\n");
                  out.write("\t &nbsp;&nbsp;<input type=\"file\" size=30 name=\"formFile");
                  out.print(i);
                  out.write("\"><br>\r\n");
                  out.write("\t ");
}
                  out.write("&nbsp;\r\n");
                  out.write("     <select>\r\n");
                  out.write("     <option value=#>选择上传类型:</option>\r\n");
                  out.write("     <option value=#>----------</option>\r\n");

⌨️ 快捷键说明

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