my dog learned polymorphism*
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
Author

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.
Craig.
Afroz Ahmed
Ranch Hand

Joined: Jan 18, 2004
Posts: 64
Hello,
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
<webapps>
<context-param>
<param-name>author</param-name>
<param-value>abc</param-value>
</context-param>
</webapps>
and access these application scope params by the two ways specified by Jack in above reply.
Regards
Afroz Ahmed
SCJP(1.4)
SCWCD..on track


The value of an idea lies in the usage of it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: application scope in servlet
 
Similar Threads
What is the difference betwees ServletContext and ServletConfig ?
Scope of a servlet
ServletContext Vs ServletConfig
Struts HTML options tag clarification
How To Get a List Object with Request?