⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uploadphoto.jsp

📁 java jsp教程
💻 JSP
字号:
<%
	/**
	 *  @author liyd
	 *  @modify by mx
	 *  @desc   附件上传
	 *  北京中软国际信息技术有限公司 审计事业部
	 */
%>
<%@ page contentType="text/html;charset=GBK" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

<html>
<head>
<title>个人照片上传</title>
<meta http-equiv="Content-Type" content="text/html;charset=GBK">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/style.css">
<script language="JavaScript" src="<%=request.getContextPath()%>/common/common.js"></script>
<style type="text/css">
<!--
body {
	background-image: url("<%=request.getContextPath()%>/images/grid.gif");
}
-->
</style>
<script language="javascript">
function doUpload(){
	var sForm = document.form1;
	if(sForm.attachmentname.value == ""){
		alert("请填写附件名称");
		sForm.attachmentname.focus();
		return;
	}
	sForm.submit();
}
</script>
</head>

<body bgcolor="#FFFFFF" background="<%=request.getContextPath()%>/images/grid.gif" text="#000000" leftmargin="0" topmargin="10">
<form name="form1" method="post" action="<%=request.getContextPath()%>/servlet/UploadPhotoServlet" enctype="multipart/form-data">
<input type="hidden" name="nofile">
<c:if test="${param.scriptno != null}">
	<input type="hidden" name="scriptno" value='<c:out value="${param.scriptno}"/>' >
</c:if>
<c:if test="${param.scriptType != null}">
	<input type="hidden" name="scripttype" value='<c:out value="${param.scriptType}"/>' >
</c:if>
<c:if test="${param.attachmenttype != null}">
	<input type="hidden" name="attachmenttype" value='<c:out value="${param.attachmenttype}"/>' >
</c:if>
<c:if test="${param.docno != null}">
	<input name="docno" type="hidden" value='<c:out value="${param.docno}"/>'>
</c:if>
<c:if test="${param.otherno != null}">
	<input name="otherno" type="hidden" value='<c:out value="${param.otherno}"/>'>
</c:if>

<TABLE cellSpacing=1 borderColorDark="#dfdfff" cellPadding=2  width="90%" align=center bgColor=#b3c4db
	   borderColorLight="#003366" border=0>
  <TBODY>
    <tr bgcolor="#a6d0f2">
      <TD height=27 colspan="4" align=left><div align="center" class="unnamed2 style3"><span class="style1">上 传 照 片</span></div></td>
    <TR style="display:block">
<c:choose>    	
<c:when test="${param.scriptno != null}">    	
      <TD width="35%" height=21 align="right" bgColor="#eef4ff">照片名称:</TD>
      <TD bgColor=#eef4ff><input name="attachmentname" size="22"></TD>
      <TD width="32%"  height=30 align="left" bgColor=#eef4ff colspan="2" >
      	<input name="file" type="file" size="16" >
      </TD>

</c:when>
<c:otherwise>
      <TD width="32%"  height=30 align="center" bgColor=#eef4ff colspan="4" >
      	上传照片:<input name="file" type="file" size="16" ></TD>
</c:otherwise>
</c:choose>
    </TR>
    <TR>
      <TD  height=30 align="right"  bgColor=#eef4ff class="unnamed1"  colspan="4">
      	<div align="center">
	  		<img src="<%=request.getContextPath()%>/images/confirm.gif" style="cursor:hand" 
	  		 align="absmiddle" alt="保存" onClick="save()">&nbsp;&nbsp;&nbsp;
	  		<img src="<%=request.getContextPath()%>/images/close.gif" 
	  		 style="cursor:hand" align="absmiddle" onClick="window.close()"></div></TD>
    </TR>
</TABLE>    
</form>
</br>
<c:if test="${param.photono != null && param.photono != ''}">
<script>
	document.form1.nofile.value = "0";
</script>	
<TABLE cellSpacing=1 borderColorDark="#dfdfff" cellPadding=2 id="xtable"
	width="90%" align=center bgColor=#b3c4db  borderColorLight="#003366" border=0>
  <TBODY>
  	<tr bgcolor="#a6d0f2">
      <TD height=27 colspan="2" align=left>
      	<div align="center" class="unnamed2 style3"><span class="style1">当前使用照片</span></div>
      </td>
    </tr>  	
  	<tr bgcolor="#a6d0f2">    
    	<tr>
    		<td width="60%" bgColor=#eef4ff align="center" style="color:blue">
    			<c:out value="${param.filename}"/>
    		</td>
    		<td width="40%" bgColor=#eef4ff align="center" style="color:red">
    			<a href="#" onclick="doDel('<c:out value="${param.photono}"/>')">删除</td>
    	</tr>
</TABLE>
</c:if>	
</body>
</html>
<c:set var="filename" value="${param.filename}"/>
<script>
	function save()
	{	
		if(document.form1.nofile.value != "" && document.form1.nofile.value == 0)
		{
				alert("请先删除旧的附件后再上传");
			  return;			
		}
		
		if(form1.scriptno){
			if(form1.attachmentname.value == "")
			{
				alert("请输入底稿附件名称");
				form1.attachmentname.focus();
				return;
			}
		}
		if(form1.file.value == "")
		{
			alert("请选择要上传的文件");
			return;
		}
		form1.submit();
		//parent.opener.location.reload();
	}
	
	function doDel(no)
	{
		//alert(window.opener.document.getElementById("attachSpan").innerHTML);
		wx=50;
		wy=50;
		x=(window.screen.width-wx)/2;
		y=(window.screen.height-wy)/2;
		wposition=",left="+x+",top="+y;
		if(confirm("确认删除该条记录?"))
		{
			if(no == "")
				return;
			var xtable = document.getElementById("xtable");
			if(xtable)
				xtable.style.display = "none";
			
			var url = "<%=request.getContextPath()%>/servlet/DelAttachmentServlet?attachNo=" + no + "&reload=true&refresh=false";
			window.open(url,"_blank","width="+wx+",height="+wy+",scrollbars=no,status=no"+wposition);
			
			//window.opener.document.getElementById("attachSpan").innerHTML="";
			//window.opener.document.form1.attachno.value="";
			//window.opener.document.form1.attachname.value="";
		}
	}
</script>

⌨️ 快捷键说明

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