• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

HFSJ p.171-176 example need help

 
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?
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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>
 
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 VI Editor Ubuntu
  • 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 VI Editor Ubuntu
  • 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 ?
 
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
 
Can you smell this for me? I think this tiny ad smells like blueberry pie!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic