M
maxwell
Linux Slackware 9.1, Tomcat 5.
I'm trying to run a simple servlet:
---------------------------
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Hello extends HttpServlet {
public void doGet (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<HTML>");
out.println("HelloHelloHello");
out.println("</HTML>");
}
}
----------------------------
This compiles fine with "javac Hello.java" and gives me
an Hello.class file in $CATALINA_HOME/webapps/ROOT/WEB-INF/classes
My web.xml file is in $CATALINA_HOME/webapps/ROOT/WEB-INF and is:
------------------
<?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>
<servlet>
<servlet-name>Hello</servlet-name>
<servlet-class>Hello</servlet-class>
</web-app>
--------------------
Yet when I load http://127.0.0.1:8080/servlet/Hello I get
"requested resource /servlet/Hello is not available"
Any ideas as to what I'm doing wrong?
Many thanks for any info.
Max
I'm trying to run a simple servlet:
---------------------------
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Hello extends HttpServlet {
public void doGet (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<HTML>");
out.println("HelloHelloHello");
out.println("</HTML>");
}
}
----------------------------
This compiles fine with "javac Hello.java" and gives me
an Hello.class file in $CATALINA_HOME/webapps/ROOT/WEB-INF/classes
My web.xml file is in $CATALINA_HOME/webapps/ROOT/WEB-INF and is:
------------------
<?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>
<servlet>
<servlet-name>Hello</servlet-name>
<servlet-class>Hello</servlet-class>
</web-app>
--------------------
Yet when I load http://127.0.0.1:8080/servlet/Hello I get
"requested resource /servlet/Hello is not available"
Any ideas as to what I'm doing wrong?
Many thanks for any info.
Max