tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Cassidy <da...@twocats.co.uk>
Subject RE: Newbie: Question about first Servlet
Date Mon, 07 Apr 2008 14:17:05 GMT
If i recall correctly the servlet must be in a package 




On Mon, 2008-04-07 at 09:52 -0400, Russo, Joe wrote:
> Try calling the servlet name instead of the class.  You may need to get
> rid of the space in the name.
> 
>  
> 
> 
> 
> -----Original Message-----
> From: Kurt L Harless [mailto:kharless@qwest.net] 
> Sent: Sunday, April 06, 2008 1:14 AM
> To: users@tomcat.apache.org
> Subject: Newbie: Question about first Servlet
> 
>  
> 
> Greetings,
> 
> 
> 
> Specifics:
> 
> Window XP
> 
> TomCat 5.5
> 
> Java 1.6
> 
> 
> 
> Created webapp dirs under;
> 
> 
> 
> C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\
> 
> 
> 
> Called ch1\WEB-INF\classes
> 
> 
> 
> In WEB-INF at created a web.xml file with the following contents;
> 
> 
> 
> <?xml version="1.0" encoding="ISO-8851-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">
> 
>             <servlet>
> 
>                         <servlet-name>Chapter1 Servlet</servlet-name>
> 
>                         <servlet-class>Ch1Servlet</servlet-class>
> 
>             </servlet>
> 
>             <servlet-mapping>
> 
>                         <servlet-name>Chapter1 Servlet</servlet-name>
> 
>                         <url-pattern>/Serv1</url-pattern>
> 
>             </servlet-mapping>
> 
> </web-app>
> 
> 
> 
> In the classes subdir to WEB-INF I compile the following java src
> successfully
> 
> 
> 
> import javax.servlet.*;
> 
> import javax.servlet.http.*;
> 
> import java.io.*;
> 
> 
> 
> public class Ch1Servlet extends HttpServlet
> 
> {
> 
>             public void doGet(HttpServletRequest request,
> HttpServletResponse response)
> 
>             throws IOException
> 
>             {
> 
>                         PrintWriter out = response.getWriter();
> 
>                         java.util.Date today = new java.util.Date();
> 
>                         out.println("<html> " +
> 
>                                         "<body>" +
> 
>                                         "<h1 align=center>HF\'s Chapter1
> Server</h1>" +
> 
>                                         "<br>" + today +
> 
>                                         "</body>" +
> 
>                                         "</html>");
> 
>             }
> 
> }
> 
> 
> 
> I installed TomCat 5.5 as a windows server and can successfully launch
> http://localhost:8080 <http://localhost:8080/>  and get the TomCat
> initial
> page
> 
> Under this page I can select the link for TomCat manager and see under
> applications an entry for /ch1
> 
> 
> 
> However, when I try to run  <http://localhost:8080/ch1/Serv1>
> http://localhost:8080/ch1/Serv1 I get HTTP Status 404 - /ch1/Serv1
> 
> 
> 
> Anyone want to help a newbie?
> 
> 
> 
> 
> 
> 
> 
> ****
> 
> 
> ****


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message