Looks normal .. you won't get a file named CreateCustomerServlet under DbTest. You should get a class named CreateCustomerServlet.class in WEB-INF/classes/servlet. That class will be called when your webapp receive's a request for http://localhost:8080/DbTest/CreateCustomerServlet (assuming tomcat was installed with listening on port 8080 and it's installed on your local workstation). That's what the <servlet-mapping> ... </servlet-mapping> part of web.xml is all about -- mapping URLs to servlets.

--David

sam wun wrote:
I got a similar web.xml, but the is different.
Here is the entire content of my web.xml.



<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" 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";>
    <display-name>
    DBTest</display-name>
    <servlet>
        <description>
        Servlet to create customers</description>
        <display-name>
        CreateCustomerServlet</display-name>
        <servlet-name>CreateCustomerServlet</servlet-name>
        <servlet-class>
        servlet.CreateCustomerServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>CreateCustomerServlet</servlet-name>
        <url-pattern>/CreateCustomerServlet</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <resource-ref>
        <description>DB Connection</description>
          <res-ref-name>jdbc/TestDB</res-ref-name>
         <res-type>javax.sql.DataSource</res-type>
         <res-auth>Container</res-auth>
    </resource-ref>
</web-app>



However, I don't see "CreateCustomerServlet" copied into my DBTest folder in the linux(tomcat) server.

Here is the project directory listing of my tomcat server (in linux):

linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # ls
.  ..  META-INF  WEB-INF  customers.jsp



Thanks

Sam







----- Original Message -----
From: David Smith
Sent: 27/08/08 11:29 pm
To: Tomcat Users List
Subject: Re: Can't execute servlet project

But if you followed the tutorial, there should be a servlet mapping in your web.xml looking like what I copied and pasted from the article below:

<servlet>
    <description>Create Customers Servlet</description>
    <display-name>ListCustomers</display-name>
    <servlet-name>ListCustomers</servlet-name>
    <servlet-class>servlet.ListCustomersServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>ListCustomers</servlet-name>
    <url-pattern>/ListCustomers</url-pat-tern>
</servlet-mapping>

This defines a servlet in the <servlet> element and then defines the URLs this servlet should service in the <servlet-mapping> element. In this case there doesn't need to be a physical file named ListCustomers in the top level of the DbTest webapp.

Your tutorial was very much geared to showing you how Eclipse works, more or less assuming you had some familiarity with servlet and/or java programming. I would recommend finding some tutorial material that focuses on servlet/jsp programming, ignoring IDEs like Eclipse.

--David

sam wun wrote:
HI there,



It sounds logical, but there is no LIstCustomers in the DBTest folder.



Thanks

Sam



----- Original Message -----
From: David Smith
Sent: 27/08/08 09:59 pm
To: Tomcat Users List
Subject: Re: Can't execute servlet project

I see .... the jsp is a view and as such wasn't designed to be run on it's own. Try http://localhost/DBTest/ListCustomers in your browser. That should hit the servlet which in turn should generate the required bean and forward the user to your jsp.

--David


sam wun wrote:
Hi, thanks for trying to help.

I dont' have a clue on this *bean*.

The entire tutorial doesn't mention about how to setup a bean...



The tutorial I;ve followed is shown as below:

http://java.sys-con.com/node/152270





Thanks

Sam





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

Reply via email to