Hi guys,
I have installed Tomcat and Apache in Win2K. I have compile a Time.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Date;
public class Time extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse rsp)
throws ServletException, IOException {
rsp.setContentType("text/html");
PrintWriter out = rsp.getWriter();
Date now = new Date(); // The current date/time
out.println("<html>");
out.println("<head><title> Time Check </title></head>");
out.println("<body>");
out.println("<p>The time is: " + now + "</p>");
out.println("</body></html>");
}
}
to Time.class and copied it to webapps\ROOT\WEB-INF\classes
The webapps\ROOT\WEB-INF\web.xml file is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<servlet>
<servlet-name>
time
</servlet-name>
<servlet-class>
Time
</servlet-class>
</servlet>
</web-app>
When I entered http://localhost:8080/servlet/time in IE 6.0, it showed
HTTP Status 500 - No Context configured to process this request
Pls help, Thanks !
kmthien
I have installed Tomcat and Apache in Win2K. I have compile a Time.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Date;
public class Time extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse rsp)
throws ServletException, IOException {
rsp.setContentType("text/html");
PrintWriter out = rsp.getWriter();
Date now = new Date(); // The current date/time
out.println("<html>");
out.println("<head><title> Time Check </title></head>");
out.println("<body>");
out.println("<p>The time is: " + now + "</p>");
out.println("</body></html>");
}
}
to Time.class and copied it to webapps\ROOT\WEB-INF\classes
The webapps\ROOT\WEB-INF\web.xml file is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<servlet>
<servlet-name>
time
</servlet-name>
<servlet-class>
Time
</servlet-class>
</servlet>
</web-app>
When I entered http://localhost:8080/servlet/time in IE 6.0, it showed
HTTP Status 500 - No Context configured to process this request
Pls help, Thanks !
kmthien