-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdelete.jsp
More file actions
63 lines (54 loc) · 2 KB
/
delete.jsp
File metadata and controls
63 lines (54 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.io.File" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="all">
<meta name="author" content="Hackyle; Kyle Shawe">
<meta name="reply-to" content="kyleshawe@outlook.com;1617358182@qq.com">
<meta name="generator" content="Sublime Text 3; VSCode">
<meta name="copyright" content="Copy Right: 2022 HACKYLE. All rights reserved">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Delete - Streaming Media Web Server</title>
<style type="text/css">
.container {
width: 100px;
margin: 0 auto;
}
</style>
</head>
<body>
<!-- 解析请求参数 -->
<%
String deleted = request.getParameter("deleted"); //是否删除
String mediaRoot = (String)application.getAttribute("mediaRoot"); //文件根目录
String dir = request.getParameter("dir"); //文件所在目录(仅仅一级)
String name = request.getParameter("name"); //文件名
pageContext.setAttribute("deleted", deleted);
pageContext.setAttribute("dir", dir);
pageContext.setAttribute("name", name);
%>
<!-- 删除确认 -->
<c:if test="${!empty deleted && deleted == 'yes' }">
<%
String rootname = mediaRoot+"/"+dir+"/"+name;
// out.println(rootname);
File file = new File(rootname);
boolean del = file.delete();
// out.println(del);
response.sendRedirect("index.jsp?mode=list");
%>
</c:if>
<c:if test="${empty deleted && deleted != 'yes' }">
<%=mediaRoot %>
<h3><b>${dir}/${name}</b></h3>
<h2 style="color: red;"><b>是否删除?</b></h2>
<div class="container">
<h1><a href="delete.jsp?dir=${dir}&name=${name}&deleted=yes">确定</a></h1>
<h1><a href="index.jsp?mode=list">返回</a></h1>
</div>
</c:if>
</body>
</html>