• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help in ServletRequestListener

 
priya rishi
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a small program for ServletRequestListener - where i have set attribute for request object .

and in my servlet i get the attribute and try to print it, where i get null.

These are my programs -

program 1 : Listener for ServletRequest


2. Servlet


i dont know why i am getting null instead of ServerName , i tried for ServletContextListener almost the same way it worked.
please any help
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String s1 = (String)request.getAttribute("ServerNamehjhgj");


What is the hjhgj doing there ?

Is your Listener declared in the web.xml ?
 
priya rishi
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It worked!!!

Is your Listener declared in the web.xml ?

i forgot to add , but now i added.

thanks sebastian , you saved my one hour of
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!