JSP Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 753 Page Views: 

How can you get a servlet context?



Posted By: Avi Date: 8 November 2010 01:50:57 AM
 Answer:

By calling getServletConfig ().getServletContext (). By calling this.getServletContext () also we will get a ServletContext object.


Posted By: avibtech


Date: 8 November 2010 01:50:57 AM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image pk5MtD
Related Questions
JSP : What happens if we write a constructor for servlet ?

What happens if we write a constructor for servlet ?

The container will always call the default constructor only. If default constructor is not present ,....
Category: JSP Date: 11/6/2010 7:40:56 PM
JSP :  What is the difference between an attribute and a parameter?

 What is the difference between an attribute and a parameter?

The return type of attribute is object, and to retrieve it, use getAttribute () and to set it use se....
Category: JSP Date: 11/6/2010 5:19:57 PM
JSP : What are the uses of ServletResponse interface?  

What are the uses of ServletResponse interface?  

ServletResponse allows the servlet to set the content length and MIME type of that response. It prov....
Category: JSP Date: 11/6/2010 5:18:58 PM
JSP : Do ActionForms have to be true JavaBeans?

Do ActionForms have to be true JavaBeans?

The utilities that Struts uses (Commons-BeanUtils since 1.1) require that ActionForm properties foll....
Category: JSP Date: 11/6/2010 3:30:00 PM
JSP : What is the difference between using request.getRequestDispatcher() and context.getRequestDispatcher()?

What is the difference between using request.getRequestDispatcher() and context.getRequestDispatcher....

We use request.getRequestDispatcher(path) when we need to give the relative path of the resource and....
Category: JSP Date: 11/6/2010 1:19:56 PM