一个查找类路径的jsp--想当好用!

03-04-23 m3310
我想知道 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>

猜你喜欢