wood burning stoves
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes servletContext() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "servletContext()" Watch "servletContext()" New topic


Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
what is a servletContext()?
if i run tomcat then all the servlets that r run from that tomcat instance is said to be in one servletContext(). right?
then what is meant when we say we want to have communication b/w two servletContexts??? two tomcats r running on the same machine or different machines?
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

if i run tomcat then all the servlets that r run from that tomcat instance is said to be in one servletContext(). right?

A ServletContext is the context in which a given servlet is running. This will be your web-application. In other words, ServletContext is the application in which a servlet is available.
When you say communication between two ServletContexts, its like communicating between two web applications. I have never done this, but theoritically speaking this is possible.
So, ONE Tomcat running on a machine allowing different applications available, to exchange data (communicating).
- satya

Take a Minute, Donate an Hour, Change a Life
Vamsidhar Chenepalli

Joined: Feb 07, 2002
Posts: 22
rephasing Satya's words..
Every App. server can have multiple web-applications. Each web application will have one servlet context under wihch all the servlets of the perticular applications will run.
Each web app. is mapped to a logical path on the server.
Servlets with in a web app. can communicate with each other using servlet context. For a detailed discussion read SRV.3 from servlet specification.
hope this helps

Vamsi Chenepalli<br />IBM Certified Enterprise Developer<br />IBM Certified Websphere Specialist<br />IBM certified solution developer for VAJ<br />IBM certified specialist for VAJ<br />SCWCD<br />Sun Certfied Java Architect<br />SCJD,SCJP
I agree. Here's the link: http://aspose.com/file-tools
subject: servletContext()
It's not a secret anymore!