What is ServletContext() and what is its use?
Answer Posted / telo
Data saved in a ServletContext scope is shared by all
servlets and JSPs in the context. The data stored in the servlet
context is destroyed when the servlet context is destroyed.
//save and get an application-scoped value
getServletContext().setAttribute(“application-value”,
“shopping-app”);
value = getServletContext().getAttribute(“application-value”);
Is This Answer Correct ? | 28 Yes | 9 No |
Post New Answer View All Answers
What’s the difference between genericservlet and httpservlet?
If a servlet is not properly initialized, what exception may be thrown?
What is generic servlet class?
Can you explain in detail 'javax.servlet' package?
How can you start a jta transaction from a servlet deployed on jboss?
Explain the working of service() method of a servlet.
What do you mean by default initialization in java servlet?
Which interface should be implemented by all servlets?
What is ServletConfig object?
When is the servlet instance created in the life cycle of servlet? What is the importance of configuring a servlet?
What is the difference between the servlets and cgi programs?
Is it possible to have a constructor inside the servlet?
Explain mvc pattern.
Explain the steps involved in placing a servlet within a package?
What is the purpose of inter-servlet communication?