Sibusiso khoza wrote:
> Sure. This is how my web.xml file looks:
>
> <?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>
> <display-name>Welcome to Tomcat</display-name>
> <description>
> Welcome to Tomcat
> </description>
>
> <!-- added the following section -->
> <servlet-mapping>
> <servlet-name>invoker</servlet-name>
> <url-pattern>/servlet/*</url-pattern>
> </servlet-mapping>
>
> </web-app>
OK. You need to remove the invoker section and do something like this:
<servlet>
<servlet-name>WebStocks</servlet-name>
<servlet-class>full.package.name.WebStocks</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WebStocks</servlet-name>
<url-pattern>/WebStocks</url-pattern>
</servlet-mapping>
and modify your application to call /WebStocks rather than
/servlet/WebStocks
Notes:
1. The invoker is really, really bad. See the FAQ for why.
2. Your servlet should be in a package and you must specify the package
name in web.xml
Mark
>
> ----- Original Message ----- From: "Patrick Herber"
> <[email protected]>
> To: "Tomcat Users List" <[email protected]>
> Sent: Monday, May 25, 2009 11:23 PM
> Subject: Re: Please help
>
>
>> Could you kindly send us an extract of your web.xml file, where the
>> Servlet and the serlvet mapping are defined?
>>
>> Regards,
>> Patrick
>>
>> Sibusiso khoza wrote:
>>> HI,
>>>
>>> I'm quite new at using tomcat. I've installed tomcat 4.1. I've
>>> followed my book (Java Programming (Shelly Cashman Series)) and
>>> modified my web.xml ("invoker") in the web-inf directory & enabled
>>> servlet reloading for tomcat. Tomcat seems to be working well & all
>>> the servlet examples work fine. I assume my classpaths are all
>>> correct.
>>>
>>> I've susscessfully compiled a servlet called WebStocks which is the
>>> controller in my MVC model and placed it in the classes folder in the
>>> web-inf directory.
>>>
>>> I am able to access the index.html through (localhost:8080/index.html).
>>> My aplication requires you to log on the index.html and when you
>>> click "log on", the userName and password are supposed to bo posted
>>> to the WebStocks servlet. However, when I click "log on", all that
>>> is displayed is: Status 404 - /servlet/WebStocks
>>>
>>> --------------------------------------------------------------------------------
>>>
>>>
>>> type Status report
>>>
>>> message /servlet/WebStocks
>>>
>>> description The requested resource (/servlet/WebStocks) is not
>>> available.
>>>
>>>
>>> --------------------------------------------------------------------------------
>>>
>>>
>>> Apache Tomcat/4.1.18
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]