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

📄 box_del.jsp

📁 基于jsp的网络百宝箱
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GB18030" import="java.sql.*,java.util.*,java.io.*"%>
<%@ include file="config.ini"%>
<%@ include file="readlogin.jsp"%>
<%
//设置转义字符
String iCanroot=dirPath.replace('\\','/');
try
{
//获取传递的要删除的文件的id和请求中的参数
String filename=request.getParameter("filename");
String action=codeToString(request.getParameter("action"));
if(filename==null)
{
         out.print("<script>");
         out.print("alert('filename错误!');");
         out.print("location.href='box.jsp';");
         out.print("</script>");
}
if(action==null)
{
         out.print("<script>");
         out.print("alert('action错误!');");
         out.print("location.href='box.jsp';");
         out.print("</script>");
}
action=request.getParameter("action");
//如果请求中的参数为del时,将调用File类中的delete()方法删除文件
if(action.equals("del"))
  {
    File delfile=new File(iCanroot+"box/"+iCan+"/"+filename);
    delfile.delete();
    out.print("<script>");
    out.print("alert('删除成功!');");
    out.print("location.href='box.jsp';");
    out.print("</script>");
  }
if(action.equals("confirm"))
  {
%>
<html>

<head>
<%@ include file="head.jsp"%>
</head>

<body>
<center>
<table border="0" width="768" id="table1" cellspacing="0" cellpadding="0">
	<tr>
	<%@ include file="top.jsp"%>
	</tr>
	<tr>
		<td width="90" valign="top">
	<%@ include file="menu.jsp"%>		</td>
		<td width="588" valign="top"><center>
		<table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0">
			<tr>
				<td>
				<table border="1" width="588" id="table4" bordercolorlight="#0A9EE4" cellspacing="0" cellpadding="5" bordercolordark="#0A9EE4">
					<tr>
						<td>
						<table border="0" width="100%" id="table5" cellspacing="0" cellpadding="0">
							<tr>
								<td>
								<table border="0" width="100%" id="table6" cellspacing="0" cellpadding="0">
									<tr>
										<td valign="bottom" width="50%">
										</td>
										<td width="50%">
										<img src="images/n-box.jpg" align="right"></td>
									</tr>
								</table>
								</td>
							</tr>
							<tr>
								<td><hr noshade color="#0A9EE4" size="1"></td>
							</tr>
							<tr>
								<td> </td>
							</tr>
							<tr>
								<td><center><table border="0" width="450" id="table2" cellspacing="0" cellpadding="0">
			<tr>
				<td><table border="0" width="450" id="table2" cellspacing="0" cellpadding="0"><tr>
				<td height="25" align="left" valign="middle" background="images/tdbg1.gif">
				<table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0">
					<tr>
						<td>
						<p align="center">
						<b><font size="2" color="#FFFFFF">删除文件</font></b></td>
					</tr>
				</table>
				</td></tr></table></td>
			</tr>
			<tr>
				<td>
				<table border="1" width="100%" id="table4" bordercolor="#156FC7" style="border-collapse: collapse" cellpadding="3" cellspacing="0" height="150">
					<tr>
						<td width="97%" align="center" height="38">
						<font size="2" color="#156FC7">确认删除下面的文件?</font></td>
					</tr>
					<tr>
						<td width="97%" height="53">
						<p align="center"><font size="2" color="#156FC7"><%=filename%></font></td>
					</tr>
					<tr>
						<td>
						<p align="center">
						<input type="button" value="提交" name="B1" style="border: 1px solid #156FC7" onclick="javascript:location.href='box_del.jsp?action=del&filename=<%=filename%>';">&nbsp;&nbsp;&nbsp;
						<input type="button" value="返回" name="B2" style="border: 1px solid #156FC7" onclick="javascript:location.href='box.jsp';"></td>
					</tr>
					</table>
				</center></td>
			</tr>
			<tr>
				<td> </td>
			</tr>
			<tr>
				<td> </td>
			</tr>
		</table></td>
							</tr>
							<tr>
								<td height="16">
								<p style="line-height: 150%">
								</td>
							</tr>
							<tr>
								<td> </td>
							</tr>
						</table>
						</td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
		<td width="90"> </td>
	</tr>
	<tr>
		<td width="90" valign="top">
	 </td>
		<td width="588" valign="top">
<%@ include file="copyright.jsp"%>
		</td>
		<td width="90"> </td>
	</tr>
</table>
<p>
</center>
</p>
</body>

</html>
<%
}
else
{
        out.print("<script>");
        out.print("location.href='box.jsp';");
        out.print("</script>");
}
}
catch(Exception e)
{
        out.print("<script>");
        out.print("location.href='box.jsp';");
        out.print("</script>");
}
%>

⌨️ 快捷键说明

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