一個查詢類路徑的jsp--想當好用!

m3310發表於2003-04-23
我想知道 system.out.println 是在哪兒定義的?

<%@page import="java.lang.*,java.io.*" %>
<%@page import="java.sql.*,java.util.*,java.net.*" %>
<%@page contentType="text/html; charset=gb2312" %>
<%!
  public class JWhich {
    public void Jwhich(){
    };
  };
%>

<html>
<head>
<title>Jwhich</title>
</head>
<body>
<form action="<%=request.getRequestURI()%> " method="post">
<input type="text" name="className" size="50" ><br>
<input type="submit" value="submit">
<input type="Reset" value="Reset">
</form>

<%  
  String className =request.getParameter("className");
  if (className != null){
    if (!className.startsWith("/")) {
       className = "/" + className;
    }
    className = className.replace('.', '/');
    className = className + ".class";
    java.net.URL classUrl = new JWhich().getClass().getResource(className);

    if (classUrl != null) {
      out.println("\nClass '" + className +
      "' found in \n'" + classUrl.getFile() + "'");
    } else {
      out.println("\nClass '" + className +
      "' not found in \n'" +
      System.getProperty("java.class.path") + "'");
    }
 
  }
 
%>
</body>
<html>// 在此輸入java程式碼
<p class="indent">

相關文章