upload.jsp

来自「jboss服务器! java开发员必备! 一般与sqlserver数据库组合」· JSP 代码 · 共 91 行

JSP
91
字号
<%@ page import="java.util.Vector,
                 org.jboss.portal.core.portlet.cms.WebDAVUtil,
                 org.jboss.portal.core.portlet.cms.admin.AdminCMSConstants"%>
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
<%@ page isELIgnored ="false" %>

<portlet:defineObjects/>

<script language="JavaScript" type="text/javascript">
   function fillform(val)
   {
      uploadform.uploadtopath.value = val;
      uploadform.showuploadtopath.value = val;
   }
</script>

<%
   Vector collList = (Vector)request.getAttribute("collList");
   WebDAVUtil wdUtil = new WebDAVUtil();
   String sCurrPath = (String)request.getAttribute("currpath");
   String sParentPath = wdUtil.fetchParentPath(sCurrPath + "/");
   String sRootPath = (String)request.getAttribute("rootpath");
   String sPath = (String)request.getAttribute("path");
%>

<form name="uploadform" method="post" enctype="multipart/form-data" action="<portlet:actionURL>
    <portlet:param name="op" value="<%= AdminCMSConstants.OP_UPLOADCONTENT %>"/>
    </portlet:actionURL>">
<input type="hidden" name="uploadtopath" value="<%= sCurrPath %>">
<table width="100%">
<th class="portlet-section-header">${n:i18n("TITLE_HEAD")} :: ${n:i18n("TITLE_UPLOAD")}</th>
<tr><td height="10"></td></tr>
<tr><td>
   <table>
   <tr>
   <td valign="top">
   <font class="portlet-font">Uploading File to directory:</font> <input type="text" name="showuploadtopath" size="35" value="<%= sCurrPath %>" class="portlet-form-input-field" DISABLED>
   <br>
   <input type="file" size="32" name="content" value="" class="portlet-form-input-field"/>
   <br>
   <input type="submit" name="submit" value="Upload file" class="portlet-form-input-field"/>
   </td>
   <td width="10"></td>
   <td valign="top">
   <font class="portlet-font">Select a directory to upload resource to, or browse to the destination directory.</font>
   <br>
   <font class="portlet-font">You are currently browsing: <%= sCurrPath %></font>
   <br><br>
   <a class="portlet-menu-item" href="<portlet:renderURL>
      <portlet:param name="op" value="<%= AdminCMSConstants.OP_UPLOADCONFIRM %>"/>
      <portlet:param name="path" value="<%= sPath %>"/>
      <portlet:param name="navpath" value="<%= sParentPath %>"/>
      </portlet:renderURL>">
      <img src="<%= renderRequest.getContextPath() + AdminCMSConstants.DEFAULT_IMAGES_PATH%>/upfolder.gif" alt="up" border="0">&nbsp;Up to Parent Directory</a>
   <br>
   <%
      // special case for root, so people can copy/move resources to it.
      if (sRootPath.equals(sCurrPath))
      {
   %>
      &nbsp;&nbsp;<img src="<%= renderRequest.getContextPath() + AdminCMSConstants.DEFAULT_IMAGES_PATH%>/plus.gif" alt="expand" border="0">
      &nbsp;<a class="portlet-menu-item" href="javascript:fillform('<%= wdUtil.cleanDoubleSlashes(sCurrPath) %>')">Root Directory</a>
      <br>
   <%
      }
      for (int i=0; i < collList.size(); i++)
      {
         String[] sAItem = (String[])collList.elementAt(i);
         String sDisplayname = sAItem[0];
         String sIsColl = sAItem[2];
         if ("COLLECTION".equals(sIsColl))
         {
   %>
      &nbsp;&nbsp;<a href="<portlet:renderURL>
      <portlet:param name="op" value="<%= AdminCMSConstants.OP_UPLOADCONFIRM %>"/>
      <portlet:param name="path" value="<%= sPath %>"/>
      <portlet:param name="navpath" value="<%= sCurrPath + "/" + sDisplayname %>"/>
      </portlet:renderURL>">
      <img src="<%= renderRequest.getContextPath() + AdminCMSConstants.DEFAULT_IMAGES_PATH%>/plus.gif" alt="expand" border="0"></a>
      &nbsp;<a class="portlet-menu-item" href="javascript:fillform('<%= wdUtil.cleanDoubleSlashes(sCurrPath + "/" + sDisplayname) %>')"><%= sDisplayname %></a>
      <br>
   <%
         }
       }
   %>
   </td></tr>
   </table>
</td></tr>
</table>

⌨️ 快捷键说明

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