http://chaoji-liangbin.blog.163.com/blog/static/25239212201061191943391/
<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="java.io.File"%>
<%!File[] configfiles;%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>配置文件管理</title>
<link href="../images/common.css" rel="stylesheet" type="text/css"></link>
<!-- <link href="../images/index.css" rel="stylesheet" type="text/css" />-->
<style type="text/css">
<!--
ol,ul ,li {
list-style: none;
}
select {
width: 200px;
}
img {
border: 0;
}
.clear {
clear: both;
height: 1px;
margin-top: -1px;
width: 100%;
}
/*此上面代码是初始CSS模板,下面是新写CSS布局框架代码*/
#header ,#centers ,#footer {
width: 100%;
margin: 0 auto;
clear: both;
font-size: 18px;
font-weight: bold;
}
#header {
height: 20px;
line-height: 32px;
}
#centers {
padding: 8px 0;
height: 160px;
}
#footer {
}
#centers .c_left {
float: left;
width: 200px;
background: #F7F7F7;
margin: 0,0,0,20%;
}
#centers .c_right {
float: left;
width: 80px;
margin: 0,0,0,2px;
padding: 0px;
}
.button {
border: 1px solid black;
width: 80px;
}
-->
</style>
<script type="text/javascript" src="../js/main.js"></script>
</head>
<body>
<%
try {
String filepath = application.getRealPath("/WEB-INF/classes/");
if (filepath.indexOf("//.//") != -1) {
int i = filepath.indexOf("//.//");
filepath = filepath.substring(0, i)
+ filepath.substring(i + 2, filepath.length());
}
//System.out.println("配置文件路径:"+filepath);
File configdir = new File(filepath + "/config");
if (configdir.isDirectory()) {
configfiles = configdir.listFiles();
}
//System.out.println("configdir:" + configdir.getAbsolutePath());
} catch (Exception e) {
e.printStackTrace();
}
%>
<form action="index.jsp" method="post">
<div id="header">
文件管理
</div>
<div id="centers">
<div class="c_left">
<SELECT size="10" id="select" name="select" multiple="single">
<%
if (configfiles != null) {
for (File xmlfile : configfiles) {
%>
<option value="<%=xmlfile.getAbsolutePath()%>">
<%=xmlfile.getName()%>
</option>
<%
}
}
%>
</SELECT>
</div>
<div class="c_right">
<INPUT class="button" type="submit" value=" 打 开 " >
<INPUT class="button" type="button" value=" 删 除 " onClick="deleteSelectItem(document.all.select);">
</div>
</div>
<div id="footer">
<label id="feedback"></label>
</div>
</form>
</body>
</html>