Originally posted by Betty Schwartz:
I have created "myServlets" directory in web-apps. My structure is
jakarta-tomcat-3.2.3
---- webapps
------ admin
------ examples
------ myServlets
--------- images
--------- META-INF
--------- WEB-INF
------------classes
-------------- HelloWorld.class
-------------- HelloWorld.java
------ ROOT
------ test
This gives these paths:
THIS IS NO GOOD
jakarta-tomcat-3.2.3\webapps\myServlets\web.xml
jakarta-tomcat-3.2.3\webapps\myServlets\classes\HelloWorld.class
IT SHOULD LOOK LIKE
jakarta-tomcat-3.2.3\webapps\myServlets\WEB-INF\web.xml
jakarta-tomcat-3.2.3\webapps\myServlets\WEB-INF\classes\HelloWorld.class
- webapps
-- myServlets
--- WEB-INF
---- classes --- HelloWorld.class
---- web.xml
classes and web.xml must be under WEB-INF
all the .class files must correspond to their package structure under classes folder
This gotta be it!!!
This is my web.xml file:
<web-app>
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name> HelloWorld </servlet-name>
<url-pattern> /hello </url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>hello</welcome-file>
</welcome-file-list>
<web-app>
I am getting a 404 Not Found when trying to access a servlet in MyServlets directory with this URL:
http://localhost:8080/myServlets/hello
This is the HelloWorld.java code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld 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("<HEAD><TITLE>Hello World</TITLE></head>");
out.println("BODY");
out.println("<BIG>Hello World<?BIG>");
out.println("</BODY></HTML>");
}
/** Creates new HelloWorld */
public HelloWorld() {
}
}
What am I missing?
Thanks for your time.
[This message has been edited by Betty Schwartz (edited September 10, 2001).]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |