如题,请大哥们说说思路或展示下代码, 不胜感激

解决方案 »

  1.   

    jsp读取跟java读取不是一样的么?
    如果java读取会的话,jsp也就行了。
    无非就是给个路径,然后用流进行读取。
      

  2.   

    java读取目录结构不是很难,File类
    http://edu.codepub.com/2009/0721/10530.php
      

  3.   

    就用File类啊,不是一样的读嘛?<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="java.io.File"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%
    String url = request.getRequestURL().toString();
    String path = url.substring(0, url.lastIndexOf("/"));
    String mainPath = path.substring(0, path.lastIndexOf("/"));
    String msg = request.getParameter("msg");
    if (msg == null) {
    msg = "";
    } String savePath = this.getServletContext().getRealPath("/")
    + "testcase";
            System.out.println(savePath); //看看取到的哪个目录?
    String[] testCaseLst = null;
    String existName = "";
    File dir = new File(savePath);
    if (!dir.exists()) {
    testCaseLst = new String[1];
    testCaseLst[0] = "";
    } else {
    testCaseLst = dir.list();
    }
    for (int i = 0; i < testCaseLst.length; i++) {
    if (testCaseLst[i].lastIndexOf(".tc") >= 0) {
    existName += testCaseLst[i].toUpperCase() + ",";
    }
    }
    %>
    <html>
    <head>.............