JSP internally uses Servlet classes to work. For every JSP page, a class that uses Servlet API is created. Servlets are objects that conform to a specific interface that can be plugged into a Java based server. Servlets are to the server-side what applets are to the client-side -- object byte codes that can be dynamically loaded off the net. They differ from applets in that they are faceless objects (without graphics or a GUI component). They serve as a platform independent, dynamically-loadable, pluggable helper byte code objects on the server side that can be used to dynamically extend server-side functionality.
What is a JSP?
JSPs are modules that extend request/response-oriented servers, such as Java-enabled web servers. For example, a JSP page might be responsible for taking data in an HTML order-entry form and applying the business logic used to update a company's order database.
JSP can be embedded in many different servers because the JSP API, which you use to write JSP pages, assumes nothing about the server's environment or protocol. JSP pages have become most widely used within HTTP servers; many web servers support the Servlet API.
Use JSP pages instead of CGI Scripts!
JSP pages are an effective replacement for CGI scripts. They provide a way to generate dynamic documents that is both easier to write and faster to run. JSPs also address the problem of doing server-side programming with platform-specific APIs: they are easy to write because it is just scripting.
So use JSP pages to handle HTTP client requests. For example, JSP pages can process data POSTed over HTTPS (Secured protocol) using a HTML form, including purchase order or credit card data. A JSP page could be part of an order-entry and processing system, working with product and inventory databases, and perhaps an on-line payment system.
Other Uses for JSPs
Here are a few more of the many applications for JSPs:
- A JSP page has intrinsic objects such as request, response, out, session and application. We can use these object directly in a JSP page for generating Dynamic Pages.
- Allowing collaboration between people. A JSP page can handle multiple requests concurrently, and can synchronize requests. This allows JSPs to support systems suchason-lineconferencing.