头大了。。。
Java环境变量配置如下:
Java_HOME:D:\jdk1.5.0_06
CLASSPATH:
.;D:\jdk1.5.0_06\lib;D:\jdk1.5.0_06\lib\tools.jar;D:\jdk1.5.0_06\jre\lib\rt.jar;D:\jdk1.5.0_06\lib\dt.jar;
PATH:D:\jdk1.5.0_06;D:\jdk1.5.0_06\bin;
可是当把以下两个文件放在同一个目录下编译时怎么都通不过。
HelloServlet3.java
[code]
package moreservlets;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloServlet3 extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws
ServletException,
IOException {
response.setContentType( "text/html ");
PrintWriter out = response.getWriter();
String title = "Hello (3) ";
out.println(ServletUtilities.headWithTitle(title) +
" <BODY BGCOLOR=\ "#FDF5E6\ "> \n " +
" <H1> " + title + " </H1> \n " +
" </BODY> </HTML> ");
}
}
[/code]
ServletUtilities
[code]
package moreservlets;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletUtilities {
public static final String DOCTYPE =
" <!DOCTYPE HTML PUBLIC \ "-//W3C//DTD HTML 4.0 " +
"Transitional//EN\ "> ";
public static String headWithTitle(String title) {
return(DOCTYPE + "\n " +
" <HTML> \n " +
" <HEAD> <TITLE> " + title + " </TITLE> </HEAD> \n ");
}
public static int getIntParameter(HttpServletRequest request,
String paramName,
int defaultValue) {
String paramString = request.getParameter(paramName);