1 Star 0 Fork 0

lidaomin / tomcat_subfile_print

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
index.jsp.bak 684 Bytes
Copy Edit Web IDE Raw Blame History
lidaomin authored 2018-10-17 19:34 . first commit
<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.io.*"%>
<%@ page import="java.net.URLEncoder"%>
<html>
<title></title>
<body>
<%
String name =request.getParameter("name");
String path = request.getContextPath("/");
if(name != null && !"".equals(name.trim())){
path = name;
}
int index = path.length();
File dir=new File(path);
File file[]=dir.listFiles();//用file对象的listFiles()方法返回指定目录下的文件
%>
<%
for(int i=0;i<file.length;i++)
{
if(file[i].isDirectory())
%>
<a href='index.jsp?name=<%=URLEncoder.encode(file[i].toString(), "utf-8")%>'>
<%
out.print("<br>"+file[i].toString().substring(index));
%>
</a>
<%
}
%>
</body>
</html>

Comment ( 0 )

Sign in for post a comment

Java
1
https://gitee.com/lidaomin/tomcat_subfile_print.git
git@gitee.com:lidaomin/tomcat_subfile_print.git
lidaomin
tomcat_subfile_print
tomcat_subfile_print
master

Search