Getting Started with JSPs: Introduction to JSP and Servlet

Source: Internet
Author: User
Tags what is asp

Transferred from: http://developer.51cto.com/art/200907/134506.htm

Getting Started with JSPs: What is a JSP?

JSP (Java Server pages) is a dynamic Web technology standard developed by Sun Microsystems, a company that many companies are involved in. Insert a Java program segment (scriptlet) and JSP tag (tag) in a traditional Web page HTML file (*.htm,*.html) to form a JSP file (*.jsp).

In short, the JSP is the HTML file that may contain the Java program segment, and in order to distinguish it from normal HTML, use the JSP suffix name. Many JSP tutorial beginning always like to take JSP and ASP comparison, but a lot of JSP beginners do not know what is ASP, interesting?

The following diagram is an ordinary HTML request flow:

Because the JSP contains the Java program code snippet, the JSP will have a lot more processing steps in the Web server. As shown in the following:

You will find that there is one more JSP container, then a conversion to a Java file called Xxxservlet and compiled into a class file process. This shows the core part of the Java server--servlet.

Getting Started with JSPs: What is a servlet?

A servlet is a server-side Java application that is independent of the Platform and Protocol, and can generate dynamic Web pages. It serves as a middle tier between a Web browser or other HTTP client that makes a request to a database or application on an HTTP server.

A servlet is a Java application located on the server side of a Web server, unlike a traditional Java application launched from the command line, which is loaded by a Web server that must contain a Java virtual machine that supports Servlets.

On servers with large traffic volumes, the advantage of Java Servlets is that they execute faster than CGI programs. Individual user requests are activated as one thread in a single program, and a separate program is created, which means that the system overhead for each request is relatively small.

In short, a servlet is a Java program that is executed on the server side, which can process the user's requests and respond to them. Servlet programming is purely Java programming, and JSP is the middle form of HTML and Java programming, which helps artists to design the interface. As such, all JSP files will eventually be translated into Java servlets for execution.

It takes a certain amount of server resources from JSP to Java to class,jsp on first request. Fortunately, this happens only once, and once the JSP file is translated and compiled into the corresponding servlet, it will be handled directly by the servlet when the next request arrives, unless the JSP has been modified.

From the above two pictures of the comparison can also be seen, as a JSP server, than the normal Web server more than a JSP container things, to be responsible for the interpretation of JSP implementation. For beginners, Tomcat will be a great choice for this application server. The latest Tomcat downloads are listed above http://tomcat.apache.org/. It is recommended to unzip the running version rather than the installation version. In fact, the decompression run version is not much more complex than the installation version, a java_home environment variable, is enough.

Getting Started with JSPs: Introducing what is JSP and servlet (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.