This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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

Win a copy of Building Microservices this week in the Design forum!
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
Have you checked out Aspose?
subject: Help in ServletRequestListener
It's not a secret anymore!