This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic