JAVA数组传给JSP页面并显示数组里面的字符串 160
publicclassFlie{/***@paramargs*/publicstaticvoidmain(String[]args){Filefile=newFile("...
public class Flie {
/**
* @param args
*/
public static void main(String[] args) {
File file=new File("C:\\Users\\Administrator\\Desktop\\website\\WEB-INF\\upload");
String test[];
test=file.list();
File srcFile = new File("C:\\Users\\Administrator\\Desktop\\website\\WEB-INF\\upload"); //指定路径
boolean bFile = srcFile.exists();
if (!bFile || !srcFile.isDirectory() || !srcFile.canRead()) {
try {
srcFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}else{
File[] file1 = srcFile.listFiles();
for(int i=0;i<file1.length;i++){
if(file1[i].getAbsolutePath().indexOf(".html")>-1)
{
System.out.println(test[i].replaceAll("[.][^.]+$", ""));
Calendar cal = Calendar.getInstance();
File f = file1[i].getAbsoluteFile();
long time = f.lastModified();
cal.setTimeInMillis(time);
System.out.println("修改时间: " + cal.getTime());}
}
}
}
怎么在JSP页面显示test[i].replaceAll(".html")>-1
帮帮忙吧大神们 展开
/**
* @param args
*/
public static void main(String[] args) {
File file=new File("C:\\Users\\Administrator\\Desktop\\website\\WEB-INF\\upload");
String test[];
test=file.list();
File srcFile = new File("C:\\Users\\Administrator\\Desktop\\website\\WEB-INF\\upload"); //指定路径
boolean bFile = srcFile.exists();
if (!bFile || !srcFile.isDirectory() || !srcFile.canRead()) {
try {
srcFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}else{
File[] file1 = srcFile.listFiles();
for(int i=0;i<file1.length;i++){
if(file1[i].getAbsolutePath().indexOf(".html")>-1)
{
System.out.println(test[i].replaceAll("[.][^.]+$", ""));
Calendar cal = Calendar.getInstance();
File f = file1[i].getAbsoluteFile();
long time = f.lastModified();
cal.setTimeInMillis(time);
System.out.println("修改时间: " + cal.getTime());}
}
}
}
怎么在JSP页面显示test[i].replaceAll(".html")>-1
帮帮忙吧大神们 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询