This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
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

Win a copy of Head First Android this week in the Android forum!
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]
It is sorta covered in the JavaRanch Style Guide.
subject: HttpServletRequest
jQuery in Action, 3rd edition