Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ p.171-176 example need help

 
Louie Cheung
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://localhost:8080/listenerTest/ListenTest.do
this is the error i got in the browser:

HTTP Status 404 - /listenerTest/ListenTest.do
type Status report
message /listenerTest/ListenTest.do
description The requested resource (/listenerTest/ListenTest.do) is not available.

---------

i compiled the three classes Dog.java, ListenerTester.java, MyServletContextListener.java successfully under C:/Tomcat5/webapps/listenerTest/WEB-INF/classes/com/example
and also web.xml under WEB-INF

what seems to be the problem?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show how you mapped ListenTest.do in your web.xml ?
 
Louie Cheung
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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/web-app_2_4.xsd"
version="2.4">

<servlet>
<servlet-name>ListenerTester</servlet-name>
<servlet-class>com.example.ListenerTester</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>ListenerTester</servlet-name>
<url-pattern>/ListenTest.do</url-pattern>
</servlet-mapping>

<context-param>
<param-name>breed</param-name>
<param-value>Great Dane</param-value>
</context-param>

<listener>
<listener-class>
com.example.MyServletContextListener
</listener-class>
</listener>

</web-app>
 
kathir vel
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Open your web.xml thru Explorer.Can you see the full content?Or is there anything missing?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also check the log of your container. You might have deployment errors.
 
Louie Cheung
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i view web.xml in explorer?
i tried
http://localhost:8080/listenerTest/WEB-INF/web.xml
and
http://localhost:8080/listenerTest/web.xml
both didn't work

and how do i view log?
sorry i'm completely new to this, thanks
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i view web.xml in explorer?

I think that Kathir meant opening web.xml in Explorer using the File/Open menu.

how do i view log?

If you are using Tomcat, you'll find logs in the "logs" directory of your Tomcat installation directory.
Which container are you using ?
 
Pandu Rangam
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
first you go through a tutorial for servlets.
you can google it. Try www.roseindia.net
 
Pandu Rangam
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i view web.xml in explorer?
just remove the xmlns ans save and double click.
 
kathir vel
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just type this in explorer address bar to open the xml file...
C:\Tomcat5\webapps\listenerTest\WEB-INF\web.xml
 
Louie Cheung
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i found the typo thanks a bunch guys
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic