Is there any differance b/w getting servlet context from
servlet config and session? if yes then what is that?
Answer Posted / frank tamaguchi
The ServletContext returned from ServletConfig and from
HttpSession are the same instance, the one instance that
exists while the web application is running. You can confirm
it with a debugger.
The main differences though are that you get a reference to
ServletConfig when in a Servlet and you get a reference to
an HttpSession from an HttpServletRequest.
You can get a reference to a ServletContext from a
FilterConfig when in a Filter.
If you are not in a Servlet and don't want to create an
HttpSession through a call to
HttpServletRequest.getSession() to be able to get a
reference to a ServletContext then create a Filter which
puts a reference to the ServletContext in a request attribute.
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
How native code can be used in a servlet?
What is Servlet API used for connecting database?
What are the phases of servlet life cycle?
What are some disadvantages of storing session state in cookies?
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
What is the use of httpservletresponsewrapper?
What are the difference between RMI and Servlets?
How to get the server information in a servlet?
What is difference between jsp and servlet?
What is the difference between Difference between doGet() and doPost()?
How do you get the ip address of the client in servlet?
Explain the servlet filter.
How to get ip address in jsp login page and how to validate like 127.1.0.1 all should not be greater than 255
Difference between doget and dopost?
Explain the lifecycle of a servlet?