Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Vijay Kumar
Servlet Context
3 Answer(s)      4 years and a month ago
Posted in : Servlet Interview Questions


Defined Servlet Context ?


Advertisement
View Answers

November 17, 2010 at 6:14 PM


ServletContext is a interface which helps us to communicate with the servlet container. There is only one ServletContext for the entire web application and the components of the web application can share it.

The Mapping of the Context init parameters in web.xml as:

<servlet>
    <servlet-name>Mapping</servlet-name>
    <servlet-class>ContextMapping</servlet-class>
</servlet>

<context-param>
    <param-name>Email</param-name>
    <param-value>userEmail@gmail.com</param-value>
</context-param>

Again we access the Init parameter in the servlet using ServletContext :

ServletContext context = getServletContext();
pw.println(context.getInitParameter("Email");


November 21, 2013 at 11:34 AM


ServletContext:

scope: Whenever we deploy the web application in the server the server create one object to ServletContext implementation class.It mean each web application contain on ServletContext object and also the server remove the ServletContext object in the given scenarios. 1) undeploy the web appliation 2) suspend the web application 3) stop the server.

uses: 1) to storing and retrieving the information in the application level 2) to finding the information about server 3) to storing the logging information int he logging files. 4) to get the RequestDispatcher object for chaining the web resources.



November 21, 2013 at 11:34 AM


ServletContext:

scope: Whenever we deploy the web application in the server the server create one object to ServletContext implementation class.It mean each web application contain on ServletContext object and also the server remove the ServletContext object in the given scenarios. 1) undeploy the web appliation 2) suspend the web application 3) stop the server.

uses: 1) to storing and retrieving the information in the application level 2) to finding the information about server 3) to storing the logging information int he logging files. 4) to get the RequestDispatcher object for chaining the web resources.



Related Tutorials/Questions & Answers:
Servlet Context
Servlet Context  Defined Servlet Context
Use Log in Servlet Context
Use Log in Servlet Context       This section illustrates you how to use log in Servlet Context. We are providing you an example. In the given example, an object of Servlet Context is defined
Advertisements
Context attributes in Servlet
Context attributes in Servlet       In this section you will study about the use of  Context Attributes in Servlet. All Servlets belong to one servlet context. A Servlet
Spring Context Loader Servlet
Spring Context Loader Servlet   ... (org.springframework.web.context.ContextLoaderServlet) Context Loader Servlet start up...; <!-- Spring context loading ends--> <!-- Standard Action Servlet
context
context  what is context in general in java ?   An association between a name and an object is called a binding, and a set of such bindings is called a context
Servlet Context
Servlet Context In this section we will read about the SevletContext...;ContextMapping</servlet-class> </servlet> <context-param> <...-value> </context-param> <servlet-mapping> <servlet-name>
Context Log Example Using Servlet
Context Log Example Using Servlet  ... of Context Log in servlet. Context Log is used to write specified message to server log file when servlet is called. In the following JSP page (message.jsp) we
Servlet Context
Servlet Context      ... the reference of the ServletContext to the context init parameters. The servlet and jsp...;ContextMapping</servlet-class> </servlet> <context-param>
context attribute
context attribute  i have writteh the program lyk this ...still error... { res.setContentType("text/html"); PrintWriter out = res.getWriter(); out.println("context... that server is not getting the path of servlet. Anyways, follow these steps: Put
Context binding
Context binding  What is meant by Context binding?   A binding context is an object that holds data that you can reference from your... context that refers to the nested view model data.   Thanks:-) public
What is Application Context?
What is Application Context?  Hello, What is Application Context? Thanks
application context file problem
application context file problem  how to configure junit application context file with struts........? it is not finding sessionfactory method
Message Context in AXIS
Message Context in AXIS  Is there any method in Axis classes to het the size of IN and OUT Message Conetext
context menu overlapped in IE8
context menu overlapped in IE8  I developed a contex menu in XHTML while opening it is overlapped in border of IE8 browser. even i have tried change the zaxis in css. I am using like below
Error in context path
Error in context path   I Tried a Struts2 Login application having... = request.getContextPath(); System.out.println("Context Path " + contextPath... ... undeploy?path=/strutsDemo OK - Undeployed application at context path /strutsDemo
Application context problem code
Application context problem code   now i am posting my code here . i... FileSystemXmlApplicationContext context = null; protected SessionFactory sessionFactory=null...( WebApplicationContext.ROOT WEB APPLICATION CONTEXT ATTRIBUTE, applicationContext
Getting Context Parameter Names
with the servlet container. There is only one Servlet Context for the entire web... of the ServletContext to the context init parameters. The servlet and jsp which...;/url-pattern> </servlet-mapping> <context-param> <
Spring Context - Writing Application Context
-hibernate.xml). This file is used by context loader servlet to initialize the Spring... servlet has its own child context that is independent of that of any other servlet... in the web.xml file to load the Spring context though Spring's context loader servlet
Add context path to URL for outputLink
Add context path to URL for outputLink  How to add context path to URL for outputLink
Java Thread Context
Thread Context       The Thread Context is required by the current thread from the group... for the development of the thread pools Every Thread required a context
What are difference between Bean Factory and Application Context ?
What are difference between Bean Factory and Application Context ?  Hi, What are difference between Bean Factory and Application Context
java.lang.NoClassDefFoundError: org/springframework/context/support/AbstractRefreshableConfigApplicationContext
java.lang.NoClassDefFoundError: org/springframework/context/support/AbstractRefreshableConfigApplicationContext  Hi, How to solve java.lang.NoClassDefFoundError: org/springframework/context/support
non static variable cannot be referenced from static context
"non static variable cannot be referenced from static context". How to solve
servlet question on web application
What is servlet context?   What is servlet Context? Given me an example
SEVERE: Context [/hospital] startup failed due to previous errors
SEVERE: Context [/hospital] startup failed due to previous errors  Hi my application is hospital i am facing this problem my build.xml file... org.apache.catalina.core.StandardContext start SEVERE: Context [/hospital] startup failed due to previous errors Jan
Regarding servlet - Servlet Interview Questions
created one servlet in that i have set the one integer value in the context,noe...,by running this servlet i m getting the context value ,now i have made another servlet which is getting the context value ,by running this servlet i m getting
servlet problem
servlet problem  wheni m deploying an servlet application im getting trouble context [/filename] startup failed due to previous error in tomcat 6.0.
Servlet
Servlet  What is Servlet
Servlet
Servlet  how to navigate one servlet page to another servlet page
servlet
servlet  is there any way to include pdf's in servlet
servlet
servlet  How many times the servlet is accessed
 

 

 

DMCA.com