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

📄 upload_append_img.jsp

📁 很好的JSP带码 有好东西大家共同分享 适合想学JSP网站建设的同志。
💻 JSP
字号:
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="../../include.jsp"%> 
<html>
<head>
<base target="top">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>添加商品附加图片</title>
<%
if ( request.getMethod().equalsIgnoreCase("post") )
{
	String name = productMgr.uploadImg(pageContext);
	out.println("<script>");
	if ( name.indexOf(".") > 0)
	{
		productMgr.setProductAppendImgFromSession(session,name);
	}
	else
	{
		out.println("alert('" + name + "')");
	}
	out.println("</script>");
}
%>

<script>
function checkF(theForm)
{	
	if (theForm.file.value=="")
	{	
		alert("请选择图片");
		return(false);
	}
	return(true);
}

function del()
{
	if ( confirm("确认删除吗?") )
	{
		return(true);
	}
	else
	{
		return(false);
	}
}

function save()
{
	var pai = "<%=productMgr.getProductAppendImgFromSession(session)%>";
	var tmpA = pai.split(",");
	var resultStr = "";
	for (i=0; i<tmpA.length; i++)
	{
		if ( tmpA[i]!="" )
		{
			resultStr += "<input type=hidden name=product_append_img value="+tmpA[i]+">";
		}
	}
	opener.document.getElementById("product_append_img_span").innerHTML = resultStr;
}
</script>
<link href="../../style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="eeeeee" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <form action="" method="post" enctype="multipart/form-data" name="form1" onsubmit="return checkF(this)" target="_self">
    <tr> 
      <td colspan="2" bgcolor="#FFFFFF"> 
        <%
String productAppendImg[] = productMgr.getProductAppendImgArrayFromSession(session);
for (int i=0; i<productAppendImg.length; i++)
{
	if ( productAppendImg[i].equals("") )
	{
		continue;
	}
%>
        <DIV style="FLOAT: left;width:115px; TEXT-ALIGN: center;"> 
          <DIV class="impc"><img src="<%=ConfigBean.getStringValue("systenFolder")%>.<%=ConfigBean.getStringValue("upload_pro_img")+productAppendImg[i]%>" width="75" height="75"></div>
          <DIV class="impc"><a onClick="return del()" target="_self" href="<%=ConfigBean.getStringValue("systenFolder")%>appController/delProductAppendImgByName?name=<%=productAppendImg[i]%>"><font color="#FF0000">删除</font></a></div>
        </div>
        <%
}
%>
      </td>
    </tr>
    <tr> 
      <td colspan="2">&nbsp; </td>
    </tr>
    <tr> 
      <td width="50%" style="padding-left:5px;padding-bottom:10px;"><input type="file" name="file"> 
        &nbsp; &nbsp; <input type="submit" name="Submit" value=" 上 传 "></td>
      <td width="50%" align="center" style="padding-left:5px;padding-bottom:10px;"><input type="button" name="Submit2" value=" 添加到商品 " onClick="save();window.close();">
        &nbsp; </td>
    </tr>
  </form>
</table>
</body>
</html>

⌨️ 快捷键说明

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