-
1. Re: Servlet is not displaying
peterj Aug 22, 2006 3:23 PM (in response to tdavisjr)What are the contents of the testservlet.war directory and of the testservlet.war/WEB-INF/web.xml file.
-
2. Re: Servlet is not displaying
tdavisjr Aug 22, 2006 3:48 PM (in response to tdavisjr)Directory structure:
root-dir - testservlet.war
dir - WEB-INF
| dir - classes
| dir - test
| - TestServlet.class
| - TestServlet.java
- web.xml
And contents of web.xml are:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Test Servlet</display-name>
I am just testing a HTTP Servlet
<servlet-name>TestServlet</servlet-name>
<servlet-class>test.TestServlet</servlet-class>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/TestServlet</url-pattern>
</servlet-mapping>
</web-app>
I hope this helps out. -
3. Re: Servlet is not displaying
peterj Aug 22, 2006 4:05 PM (in response to tdavisjr)You need to either add a welcome-file-list to your web.xml:
<welcome-file-list> <welcome-file>TestServlet</welcome-file> </welcome-file-list>
or use the following url:
http://localhost:8080/testservlet/TestServlet -
4. Re: Servlet is not displaying
tdavisjr Aug 22, 2006 4:31 PM (in response to tdavisjr)Worked like a charm. Thank you. Do you have any idea why this wasn't required for Tomcat configuration? Is it because of a different root context?
-
5. Re: Servlet is not displaying
peterj Aug 22, 2006 4:36 PM (in response to tdavisjr)Actually, I am surpRised that it worked under Tomcat, you should have seen the directory listing there also. Or did you, by any chance, place the testservlet directory under ROOT?
-
6. Re: Servlet is not displaying
tdavisjr Aug 22, 2006 4:55 PM (in response to tdavisjr)Ok. My goodness. I feel like a dope. Actually, I was actually accessing the servlet via: http://localhost/testservlet/TestServlet, under Tomcat
however,
when I migrated to JBoss I typed the servlet mapping in all lowercase when it should have been in Pascal Case. So, I go a 404 error and I thought it was the wrong URL or the context was incorrect.
Sorry, for the trouble. I'm just beginning with ejb, servlets and jsp's and I migrating to JBoss since I didn't see anything that said Tomcat is a container for EJB's.