Dear caller,
What webserver you have use. If you want to run a
servlet file then first you set the virtual path of
webserver. In every webserver there must be a specific
directory which is mapped default.
In case of JavawebServer default directory for servlet
class file is: Javahome_directory:\class
In case of JSWDK-1.0.1 default directory for servlet
class file is: jswdk-1.0.1\examples\web-inf\servlets
In case of SDK default directory for servlet class
file is: SDKhome_directory:\servlet
I hope it's help to solve your problem.
From
Raj
--- Richard Tham <richardtham@y...> wrote:
> 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( "
> ---<BR>
> Do you know what you want from this list? How would
> you provide programmers with the solutions they
> need? If you have the answers, and are willing to
> work in Birmingham (UK), then you could be a List
> Manager. Please send CVs and a covering letter to
> listsupport@p... for further information.
> <BR>
> ---<BR>
> raj_kundu@y...<BR>
> $subst('Email.Unsub')
> </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 !!!
>
>
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/