File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HttpServletRequest 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 "HttpServletRequest" Watch "HttpServletRequest" New topic


S Sravs
Ranch Hand

Joined: Feb 25, 2008
Posts: 85
can we get HttpServletRequest object in listeners?
if so how?
if not why?

Thanks inadvance.
manokaran.d durairaj

Joined: Oct 03, 2007
Posts: 1
HttpServletRequest not in Listeners. Because Listeners only look for attribute added removed and also .don't want the client request or response.
Aditya Singh
Ranch Hand

Joined: Mar 06, 2008
Posts: 62
Pls refer -
Steve James
Ranch Hand

Joined: Apr 12, 2009
Posts: 44
Definately possible

There is a Listener called as ServletRequestListener , it has got a method called public void requestInitialized(ServletRequestEvent rre)

and from ServletRequestEvent.getServletRequest() which returns the ServletRequest.

I am just a brick in the wall of Java
Abdul Rahman
Ranch Hand

Joined: Jul 04, 2008
Posts: 63
Hi Vijaya,

can we get HttpServletRequest object in listeners?
if so how?
if not why?

There are 8 listeners and 6 events associated with these listeners. out of these 6 events only ServletRequestEvent Class has got a method getServletRequest().
so if you are writing a class that implements ServletRequestListener interface, then you get ServletRequestEvent. From this event you can call getServletRequest(). you will have to cast it to HttpServletRequest.
You will not get request objects in other listeners because the API does not provide for it.

Hope this helps.

SCJP5, SCWCD5, [scwcd wall of fame]
I agree. Here's the link:
subject: HttpServletRequest
It's not a secret anymore!