This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages 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