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

application scope in servlet

kesava chaitanya
Ranch Hand

Joined: Aug 15, 2001
Posts: 140
How will u set application scope in servlet?
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
There are at least two ways you can set an object in the Application scope. Both ways lead to you getting the ServletContext object.
1) This is usually done in the init(ServletConfig config) method.

2) If your Servlet extends HttpServlet. You can invoke the

But I think you get the idea.
Afroz Ahmed
Ranch Hand

Joined: Jan 18, 2004
Posts: 64
Exactly the same as Jack written.And also you can set the application scope paramater in web.xml at starting of your web application by
and access these application scope params by the two ways specified by Jack in above reply.
Afroz Ahmed
SCWCD..on track

The value of an idea lies in the usage of it.
I agree. Here's the link:
subject: application scope in servlet
It's not a secret anymore!