|
 |
pro_jsp thread: My Servlet Won't Run, Pls Help !!
Message #1 by richardtham@y... on Wed, 20 Sep 2000 20:50:46 +0100
|
|
My Servlet Won't Run, Pls Help !!
I have make a html page here to be linked to a servlet:
http://www.mycgiserver.com/~richardtham/HTTPGetServlet.html
I could compile the java file and upload the class file to this directory:
http://www.mycgiserver.com/~richardtham/HTTPGetServlet?
My HTTPGetServlet in java codes are as follows:
//HTTPGetServlet.java
// Creating and sending a page to the client
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class HTTPGetServlet extends HttpServlet {
public void doGet( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException
{
PrintWriter output;
response.setContentType( "text/html" ); // content type
output = response.getWriter(); // get writer
// create and send HTML page to client
StringBuffer buf = new StringBuffer();
buf.append( "<HTML><HEAD><TITLE>\n" );
buf.append( "A Simple Servlet Example\n" );
buf.append( "</TITLE></HEAD><BODY>\n" );
buf.append( "<H1>Welcome to Servlets!</H1>\n" );
buf.append( "</BODY></HTML>" );
output.println( buf.toString() );
output.close(); // close PrintWriter stream
}
}
However, once I run the html file, it gives me this error msg:
The page cannot be found
The page you are looking for might have been removed, had its name
changed, or is temporarily unavailable
Pls help me !!!
|
|
 |