The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Help in ServletRequestListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Help in ServletRequestListener" Watch "Help in ServletRequestListener" New topic

Help in ServletRequestListener

priya rishi
Ranch Hand

Joined: Oct 26, 2008
Posts: 119
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

Joined: Feb 23, 2009
Posts: 1183
String s1 = (String)request.getAttribute("ServerNamehjhgj");

What is the hjhgj doing there ?

Is your Listener declared in the web.xml ?

JDBCSupport - An easy to use, light-weight JDBC framework -
priya rishi
Ranch Hand

Joined: Oct 26, 2008
Posts: 119
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
Consider Paul's rocket mass heater.
subject: Help in ServletRequestListener
Similar Threads
A Question about ServletRequestListener behaviour
serveltrequestlistener problem
ServletRequestListener problem
Servlet Request Listener Query
Informal Survey - Use of Listeners