In this tutorial you will learn about the modification in ServletContext interface's made in Java EE 6.
Definition of ServletContext is remain same, as usual you know the definition of ServletContext as it is an interface into which the methods are defined for the purpose of communicating a Servlet with its servlet container. Servlet container for each web application creates an only one i.e. a single context on the application deployment at per Java Virtual Machine that can share the common information to all the components. Here is one thing should be remember that a ServletContext object is contained within the ServletConfig object. To initialize a global variable for a web application it should be make an entry of <contex-param></context-param> as a sub element of <web-app></web-app> element in web.xml file. for example :
<web-app> <context-param> <param-name>userId</param-name> <param-value>bipul</param-value> </context-param> </web-app>
You can read the complete tutorial about the <context-param> from here.
In the Java EE 6 there are various of methods are added in ServletContext. Some of these are as follows :
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: ServletContext Java EE 6
Post your Comment