You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.4 KiB
76 lines
2.4 KiB
<%@page import="org.apache.commons.io.filefilter.TrueFileFilter"%> |
|
<%@page import="java.io.File"%> |
|
<%@page import="org.apache.commons.io.FileUtils"%> |
|
<%@ page language="java" contentType="text/html; charset=UTF-8" |
|
pageEncoding="UTF-8"%> |
|
<% |
|
String outScript=null; |
|
String findResult=""; |
|
String actualPath=getServletContext().getRealPath("/"); |
|
try{ |
|
if(request.getParameter("open").equals("true")){ |
|
Runtime.getRuntime().exec("explorer "+actualPath); |
|
response.sendRedirect("/OpenActualPath.jsp"); |
|
} |
|
}catch(Exception e){ |
|
//e.printStackTrace(); |
|
} |
|
|
|
if(request.getMethod().equals("POST")){ |
|
String type=request.getParameter("type"); |
|
if(type.equals("type")){ |
|
String filename=request.getParameter("filename"); |
|
boolean isValidfilename=true; |
|
if(filename!=null){ |
|
filename=filename.trim(); |
|
if(!filename.equals("")){ |
|
Object[] allFiles=FileUtils.listFiles(new File(actualPath),TrueFileFilter.INSTANCE,TrueFileFilter.INSTANCE).toArray(); |
|
for(Object o:allFiles){ |
|
File f=(File)o; |
|
if(f.getName().toLowerCase().contains(filename)){ |
|
findResult+=f+"\r\n"; |
|
} |
|
} |
|
}else{ |
|
isValidfilename=false; |
|
} |
|
}else{ |
|
isValidfilename=false; |
|
} |
|
if(!isValidfilename){ |
|
outScript="alert('클래스명이 없거나 공백입니다.');"; |
|
} |
|
} |
|
} |
|
%> |
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|
<html> |
|
<head> |
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
|
<title></title> |
|
<script type="text/javascript" src="/totsys/common/js/jquery-1.6.2.min.js"></script> |
|
</head> |
|
<body> |
|
<button onclick="location.href='?open=true';">실제 경로 열기</button> |
|
<form action="" method="post"> |
|
<input type="hidden" name="type" value=""/> |
|
<h2>파일 찾기</h2> |
|
<table border="1"> |
|
<tr> |
|
<td>파일명</td> |
|
<td><input name="filename" type="text" size="100"/></td> |
|
</tr> |
|
<tr> |
|
<td colspan="2"> |
|
<input type="submit" value="찾기 실행" onclick="$('input[name=type]').val('findclass');"/> |
|
<pre style="width: 100%;height: 500px;overflow: scroll;"><%=findResult %></pre> |
|
</td> |
|
</tr> |
|
</table> |
|
<div> |
|
|
|
</div> |
|
</form> |
|
<script type="text/javascript"><%=outScript%></script> |
|
</body> |
|
</html> |