What is the difference between servlet config and servlet
context.
Answer Posted / amit singh(mca ,niet)
servlet config is a configuration object used by the
servlet container to pass information to a servlet to a
durimg intialization ,before calling the service method to
a request it calls the init(servlet config) to intialize
the servlet ,at this time it loads all the parameter the
servlet neede, if you need that some parameter only has
relation with the servlet not the whole webapplication you
should to go with servlerconfig ,we use it in
deploymentdescriptor,if you want those information those
you want to use for whole application in which many servlet
so use servletcontext
caution is that :-try to not use servlet context in web
application becaz they are not thread safe
and in deploy ment descritor you use like that:-
<web-app>
<context-param>
<param-name>............<param-name>
<param-value>..........<param-value>
</contextparam>
<servlet>
<servlet-name>.............</servlet-name>
<servlet-class>..........</servlet-class>
<init-param>
<param-value>..........</parm-value>
<param-value>........</param-value>
</init-param>
</servle..
</web-ap...
i think u got the right answer ,and best of luck
AMIT SINGH (MCA,NIET,greaternoida) and my email id
amitsing2008@gmail.com for those want more answer related
to java
| Is This Answer Correct ? | 57 Yes | 8 No |
Post New Answer View All Answers
Which http method is said to be non-idempotent and idempotent?
What are important features of Servlet 3?
Describe in brief RequestDespatcher?
What is servlet mapping?
What are the drawbacks of cgi?
Where do you define dispatcherservlet?
What is SingleThreadModel interface?
What is servlet instance?
Hi frnd can i any one kindly can post for me portlet,hibernate and spring example application and with flow explantion configuration using Jdeveloper.and related links ar tutorials kindly please send me .its urgent for me .thanks in advance...........else can any one send to kondaiah.goddeti@gmail.com
Which method is called when reference variable is passed in system.net?
What is servlet configuration?
What is the difference between sendredirect() and forward() in a servlet?
How can we perform any action at the time of deploying the project?
How will two or three servlets interact or communicate with each other?
What is difference between cookies and httpsession?