File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Why is this piece of code required from a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Why is this piece of code required from a servlet" Watch "Why is this piece of code required from a servlet" New topic
Author

Why is this piece of code required from a servlet

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hai , i have see a lot of codings in which this piece of code is always present.

ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());


Please tell me what is the use of this one .


Save India From Corruption - Anna Hazare.
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

You need it if you want to get the ApplicationContext from a servlet. Suppose you want to get a bean "myBean" from a servlet, then you need to do this.


Hope this helps.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you ver much Freddy (Federer )
 
 
subject: Why is this piece of code required from a servlet