ENDRPrint/web/endrlistfile.jsp

156 lines
3.6 KiB
Plaintext
Raw Normal View History

2024-08-14 10:33:27 +07:00
<%@ page import="th.co.muangthai.endrprint.util.VSMUtil" %>
<%@ page import="th.co.muangthai.endrprint.model.hibernate.HibernateUtil" %>
<%@ page import="java.io.*" %>
<!--%@ page import="th.co.muangthai.model.service.wf.WorkflowWS" %-->
<%@ page import="java.util.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<%--<META HTTP-EQUIV="Refresh" CONTENT="5">--%>
<head>
<title></title>
<script>
function go(){
setTimeout(window.location='#bottom',20000 );
}
</script>
</head>
<%--<body onload='go()'>--%>
<body>
<br/>
<%
if (request.getParameter("file") == null)
{
// /LOGGING2/ENDR/File/LOF4POSWeb.log
String logFile = "/LOGGING2/PRTENDR/File/";
File dir = new File(logFile);
if (dir.isDirectory())
{
File[] fileArray = dir.listFiles();
List<File> fileList = new ArrayList<File>();
for (File file : dir.listFiles())
{
fileList.add(file);
}
logFile = "/LOGGING2/PRTENDR/Service/";
dir = new File(logFile);
if (dir.listFiles() != null)
{
for (File file : dir.listFiles())
{
fileList.add(file);
}
}
Collections.sort(fileList, new Comparator<File>() {
public int compare(File o1, File o2) {
return o1.lastModified() == o2.lastModified() ? 0 : (o1.lastModified() < o2.lastModified() ? 1 : -1 ) ;
}
}
);
%>
<table width="1000">
<%
int count = 0;
for (File file : fileList)
{
%>
<tr>
<td width="50" style="border-bottom: #fbc7f9 1px solid"><%=++count%></td>
<td width="500" style="border-bottom: #fbc7f9 1px solid"><%=file.getName()%></td>
<td width="300" style="border-bottom: #fbc7f9 1px solid" align="center"><%=new Date(file.lastModified())%></td>
<td style="border-bottom: #fbc7f9 1px solid">
<a href="endrlistfile.jsp?file=<%=file.getAbsolutePath()%>">
View
</a>
</td>
</tr>
<%
}
%>
</table>
<%
}
}
%>
<%
if (request.getParameter("file") != null)
{
String logFile = null;
try
{
if (VSMUtil.isNotEmpty(request.getParameter("file")))
{
logFile = request.getParameter("file");
}
if (VSMUtil.isNotEmpty(request.getParameter("fileName")))
{
logFile = "/LOGGING2/PRTENDR/File/" + request.getParameter("fileName");
}
}
catch (Exception e)
{
out.println("error1 : " + e);
}
%>
path : <%=logFile%>
<br/><br/>
<pre>
<%
try
{
BufferedReader input = new BufferedReader(new FileReader(logFile));
String line = "";
while ((line = input.readLine()) != null) {
out.println(line);
}
out.flush();
input.close();
}
catch (Exception e)
{
out.println("error2 : " + e);
}
%>
</pre>
<%
}
%>
</body>
<%--<div id="bottom"></div>--%>
<%--<a name='bottom'>&nbsp;</a>--%>
</html>