This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "getting HttpServletRequest Object?" Watch "getting HttpServletRequest Object?" New topic
Author

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 ]

Regards,
Jignesh

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

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
 
jQuery in Action, 2nd edition
 
subject: getting HttpServletRequest Object?
 
Similar Threads
Can I clone Request Object
JSF context problem
JSF Radio buttons in two column format
Finding the type browser from Servlet
SSL & relative urls.