Servlet acts as the middle layer between the client requests and the applications hosted on the server. Servlets are used to collect data from the users, for example, forms, and also to create web pages dynamically and present the results. JSP, an acronym for Java Server Pages, is an extensive collection of technologies, which are used to develop web pages. Servlets generate dynamic content, interact with the client, and are maintained by Servlet engine containers.
Servlets are used to extend the functions provided by the servers. Servlets are a method to develop web applications by implementing them in a platform-independent and component-based approach. JSPs are utilised for server-side programming and are also used to create platform-independent, dynamic web applications.
If we want to have a clear view of JSP vs. Servlet , we can compare them on the following factors to help decide which one is a better choice if there is any specific requirement. This makes their memory efficient and faster. The response time is significantly less, as it saves time to respond to the first request. Servlets are easily accessible, as they use standard API that is used by a large number of web servers. It is easy for development and is platform-independent.
Servlets help developers access a large number of APIs, which are available for Java. It is very easy to maintain multiple Servlets for a single web application. JavaServer Pages Technology 6. JavaServer Pages Documents 7. Scripting in JSP Pages JavaServer Faces Technology Developing with JavaServer Faces Technology Creating Custom UI Components Configuring JavaServer Faces Applications Enterprise Beans Getting Started with Enterprise Beans Their most common use is to extend Web servers, providing a very secure, portable, and easy-to-use replacement for CGI.
A servlet is a dynamically loaded module that services requests from a Web server. It runs entirely inside the Java Virtual Machine. Because the servlet is running on the server side, it does not depend on browser compatibility. Practical Applications for Java Servlets Servlets can be used for any number of Web-related applications.
The following are three examples : Developing e-commerce "store fronts" will become one of the most common uses for Java servlets. A servlet can build an online catalog based on the contents of a database. It can then present this catalog to the customer using dynamic HTML.
The customer will choose the items to be ordered, enter the shipping and billing information, and then submit the data to the servlet. Get free ground shipping on all U.
Shop now. In this chapter the concept of Servlets, not the entire Servlet specification, is explained; consider this an introduction to the Servlet specification starting strictly with Servlets.
At times the content of this chapter may seem dry, even reminiscent of the actual specification. While an attempt is always made to liven the material up, however, there are several relevant but boring aspects of Servlet development that need to be presented now. Do attempt to read the whole chapter straight through, but also remember you can always reference this chapter when needed.
Java Servlets are an efficient and powerful solution for creating dynamic content for the Web. Over the past few years Servlets have become the fundamental building block of mainstream server-side Java. The power behind Servlets comes from the use of Java as a platform and from interaction with a Servlet container.
The Java platform provides a Servlet developer with a robust API, object-orientated programming, platform neutrality, strict types, garbage collection, and all the security features of the JVM. Complimenting this, a Servlet container provides life cycle management, a single process to share and manage application-wide resources, and interaction with a Web server. Together this functionality makes Servlets a desirable technology for server-side Java developers. Java Servlets is currently in version 2.
The Servlet 2. Servlets are always part of a larger project called a Web Application. A Web Application is a complete collection of resources for a Web site. Nothing stops a Web Application from consisting of zero, one, or multiple Servlets, but a Servlet container manages Servlets on a per Web Application basis.
Web Applications and the configuration files for them are specified by the Servlet specification. Servlets are most popularly used for generating dynamic content on the Web and have native support for HTTP. Filters were officially introduced in the Servlet 2. Filters greatly complement Servlets and are commonly used for things such as authentication, content compression, and logging.
Servlets already use the security features provided by the Java Virtual Machine, but the Servlet specification also defines a mechanism for controlling access to resources in a Web Application. One of the best features of a Servlet is the ability to develop content for just about any language.
A large part of this functionality comes directly from the Java platform's support for internationalization and localization. The Servlet API keeps this functionality and can be easily used to create content in most of the existing languages. For simplicity, this chapter focuses on the basics of Servlets and leaves more complex but practical examples for discussion in pertinent, later chapters. Filters, security, and true internationalization issues are all discussed in later chapters as they pertain to both Servlets and JSP.
0コメント