File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes getting HttpServletRequest Object? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "getting HttpServletRequest Object?" Watch "getting HttpServletRequest Object?" New topic

getting HttpServletRequest Object?

Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
Hi ,

somehow in the init() method can i have the HttpServletRequest object ??
[ June 30, 2006: Message edited by: Bear Bibeault ]


The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

You can't
The request object is generated when a request is made to your app (someone hits your site with a browser).

The init method occurs when the servlet is being deployed (before any requests can be made).

As far as your servlet is concerned: no request objects exist when your init method is being called.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: getting HttpServletRequest Object?
It's not a secret anymore!