• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in Servlet Request Attribute Listener

 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying a example on ServletRequestAttributeListener. It's giving error:





Whether for this also, we havr to register in web.xml like below

 
Sreeraj G Harilal
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing wrong with your code. It works fine.
Please check your classpath or other tomcat settings.
 
VijayKumar Sivagnanam
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Micheal,

You have to register the ServletRequestAttributeListener in the web.xml. Try it and let me know.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You definintely need to add an entry into your web.xml file. Make sure it is there. Although, I would have thought that if it wasn't there, it would just be ignored, as opposed to causing a runtime error?

I have a bunch of tutorials on my website about J2EE and web development. One deals with Listeners, although it is a session listener, as opposed to a request listener. Still, it's the same idea. Plus, the web.xml code is on the page. It might be helpful:

Tutorial on Configuring Listeners in a Servlet/JSP Based Application - With Code!

I hope that helps.

-Cameron McKenzie
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have registerd in the web.xml..

I have the following classpath:
D:\jdk1.5.0_01\lib\servlet.jar;D:\jdk1.5.0_01\lib\xerces-2.3.0;D:\jdk1.5.0_01\lib\xml-apis;.;

I have the below import statemnt:
import javax.servlet.*; //(which will cover all)
import javax.servlet.http.*;//(which will cover all)
import java.io.*;

Other servlets and JSP are compiling & running fine..even I tried the ServletContextListener example from HFSJ and it's wirks fine..

I think it shouldn't be a classpath problem..

And also,Whether for all Listener interfaces, where (in which class) the implementation is implemented does matter? What will be the pros and cons or any guidelines for it?pls explain

Any glue..?
[ December 30, 2006: Message edited by: Micheal John ]
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I couldn't figure out the problem..any help...?
 
VijayKumar Sivagnanam
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,

You are having the listener in your servlet itself. Try creating the listener separately and give a try.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic