Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How native code can be used in a servlet?

4020


What is Servlet API used for connecting database?

1049


What are the phases of servlet life cycle?

1060


What are some disadvantages of storing session state in cookies?

973


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

2132


What is the use of httpservletresponsewrapper?

914


What are the difference between RMI and Servlets?

1521


How to get the server information in a servlet?

1119


What is difference between jsp and servlet?

1122


What is the difference between Difference between doGet() and doPost()?

1218


How do you get the ip address of the client in servlet?

950


Explain the servlet filter.

932


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

3346


Difference between doget and dopost?

1111


Explain the lifecycle of a servlet?

913