Get your CodeRanch badge!*
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Help in ServletRequestListener" Watch "Help in ServletRequestListener" New topic
Author

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

SCJP 5 , SCWCD 5
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help in ServletRequestListener
 
Similar Threads
serveltrequestlistener problem
Informal Survey - Use of Listeners
ServletRequestListener problem
Servlet Request Listener Query
A Question about ServletRequestListener behaviour