• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

adding listener to DTD file but not working

 
jayash samaiya
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I am using the following code in DTD file all works fine.
<?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">

<servlet>
<description>
</description>
<display-name>ServletNsep</display-name>
<servlet-name>ServletNsep</servlet-name>
<servlet-class>
com.tcs.h107.AccountController.ServletNsep</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletNsep</servlet-name>
<url-pattern>/ServletNsep</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>
</web-app>


But when I add the listener declaration as <listener>
<listener-class>
MyServletContextAttributeListener
</listener-class>
</listener>
into this file and run the applicatin again it tells HTTP Status 404 - /Nsep_Account/transactions_home.jsp

Description-webpage not available.


 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your listener class has to be in a package, just like your servlet classes do. (It doesn't have to be the same package, just a package.)
 
jayash samaiya
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Your listener class has to be in a package, just like your servlet classes do. (It doesn't have to be the same package, just a package.)


Still the problem persist :-) . Am I making any mistake in declaring the listener in DTD file.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand what your listener has to do with the 404, how are they linked?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic