To execute a JSP file (known as JSP page), the Web server should be loaded with a software capable to execute JSPs. The software loaded should provide an environment for a JSP to execute. This environment is known as JSP engine or JSP container. Similarly, a Servlet container provides environment for a Servlet to execute.
A Web container is a general term which executes Web programs like ASP, Servlets, JSP, PHP etc. So, a JSP container and a Servlet container are Web containers.
In general, a container has the following responsibilities:
- Should provide standard libraries required for coding.
- Should provide suitable environment for execution.
- Should call callback methods at appropriate times for the smooth execution.
- Should maintain the life cycle of the program
In particular a, JSP container responsibilities:
The JSP container should be capable to translate JSP file to a Servlet file, compile the servlet file, execute the Servlet and send the output of execution to client as response. As internally, a JSP file is converted to Servlet, the JSP container should also come with a Servlet container.
In particular, a Servlet container responsibilities:
- Should capable to load the Servlet .class file at the request of the client, execute the Servlet.
- Accees the database server, if required.
- When the response is delivered close the connection with the client.
Send the output of execution to client as response.
- Related Topics
- What are the prerequisites to learn JSP?
- What is JSP (Java Server Page)?
- 15 advantages of JSP over Servlets
- What is JSP engine or what is JSP container?
- How JSP works or What is JSP Architecture?