📄 picturedirtypemanager.jsp
字号:
<%@ page language="java" import="java.util.*,java.sql.*,java.io.*,java.io.File" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'PicturedirtypeManager.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body style="BACKGROUND: #000000" onload="onload=init()">
<P>
<BR>
</P><CENTER>
<FONT color="#0000ff" size="5">欢迎光临我的电子相册网</FONT>
</CENTER><P></P><P>
<BR>
<FONT color="#ff0080">欢迎你,<%=session.getAttribute("id")%></FONT>
</P>
<FONT color="#ff0080"><A href="Index.jsp"><FONT color="#23ded5">首页 </FONT></A><FONT color="#23ded5"> </FONT></FONT>
<A href="Createdir.jsp"> <FONT color="#23ded5">创建相册</FONT></A>
<FONTcolor ded5="">
<FONT></FONT>
<A href="Upload.jsp"><FONT color="#23ded5"> 照片上传</FONT></A>
<FONT color="#23ded5"> </FONT>
<A href="MyManager.jsp"><FONT color="#23ded5">返回</FONT></A><DIV class="ttl1" id="ttl0">
<SPAN class="ttl1"></SPAN>
</DIV><P></P>
<BR>
<TABLE id="table1" bordercolor="#23ded5" width="400" border="1">
<CENTER><FONT color="#ff0080">
</FONT><TR>
<TD><FONT color="#ff0080">相册名字 </FONT></TD>
<TD><FONT color="#ff0080">查看 </FONT></TD>
<TD><FONT color="#ff0080"> 删除</FONT></TD>
</TR>
</CENTER>
<%
String myid=(String)session.getAttribute("id");
String deldir;
int flag = 0;
if(session.getAttribute("del")!=null)
{
deldir=(String)session.getAttribute("del");
flag = 1;
}
else deldir=null;
File del=new File("C:\\test\\"+myid+"\\"+deldir);
if (!(del == null || !del.exists() || !del.isDirectory()))
{
File[] files = del.listFiles();
for(int i = 0;i<files.length;i++){
if(files[i].isFile()){
files[i].delete();
}
}
del.delete();// 删除目录本身
}
session.setAttribute("del",null);
String dsql="delete from userdir where ID='"+myid+"' and DirName='"+deldir+"'";
try {
Class.forName("com.mysql.jdbc.Driver");
Connection c = DriverManager
.getConnection("jdbc:mysql://localhost/myphone?user=root&password=123456"); // 连接mysql数据库
Statement s = c.createStatement();
if(flag == 1)
s.executeUpdate(dsql);
dsql="delete from picture where ID='"+myid+"' and dirname='"+deldir+"'";
if(flag == 1)
s.executeUpdate(dsql);
String sql="select * from userdir where ID='"+myid+"'";
ResultSet r = s.executeQuery(sql);
while(r.next())
{
System.out.println(r.getString(2));
%>
<CENTER>
<TR>
<FONT color="#ff0040">
<TD><font color="#ff0040"><%=r.getString(2) %></font> </TD>
<TD><A href="showdirpicture.jsp?dir=<%=r.getString(2) %>&number=0">查看 </A> </TD>
<TD><A href="javascript::void(0)">删除 </A></TD>
</TR>
</FONT>
</CENTER>
<%
}
s.close();
} catch (Exception e) {
e.printStackTrace();
}
%></TABLE>
<BR>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -