I recently started learning java and JSP. To run JSP I was informed that I need to download apache tomcat. I did that and configured it to eclipse and got results. What exactly is this apache tomcat and why does JSP need it?
-
1You didn't even Google "apache tomcat" to find out what it was? – Christopher Schultz Aug 10 '12 at 14:31
-
Hey I did do that, the wikipedia article did have a lot of detail about apache tomcat. However for some reason I wasn't able to understand its relationship with JSP and why I was required to have it. I'm sorry if I caused you any irritation by posting this question :( – raj_n Aug 10 '12 at 21:42
2 Answers
It's a servlet or web container.
What does it do ? It directs incoming HTTP requests to one of many servlet applications it manages, and looks after the separation of those apps, threading/management of requests, and the network I/O.
If you didn't have this, you'd have to write the networking code, the HTTP protocol code, threading for the incoming requests, sandboxing of different applications (via classloaders) and handling of servlets' lifecycles (initialisation/destruction etc.)
With a servlet container, you can concentrate on the incoming HTTP requests that you're provided and providing suitable output as an HTTP response, and not worry about any of the above.
The JSPs you're writing are a specialised form of servlet.

- 268,207
- 37
- 334
- 440
Apache Tomcat is a servlet container
It interprets Servlets on which JSP files are based
For your Java EE applications you can use a servlet container like Tomcat or an application server like JBoss which can manage EJBs this post describe the difference between servlet container and application server