Java EE Dynamic Web page technology-jsp

Source: Internet
Author: User

Learning JSP, what we need to know is what is JSP? What are the characteristics of JSP? What is the relationship between JSP and svelte?


The first concept: JSP is the server-side running a scripting language, which is similar to CGI, ASP, PHP and so on.  

CGI: In single-process mode, each time a server-side service is requested, a new thread needs to be started. So when multiple users are making CGI requests at the same time, the server will open multiple processes, aggravating the burden on the server, making the server's execution more inefficient.

ASP: Microsoft has developed a background scripting language, features simple and easy to use, its limitations are only in the Microsoft server platform to run well, can not achieve cross-platform.

    PHP : php The source code is fully public and can be downloaded freely on the internet. jsp provides many functions connected to the database, The disadvantage is that the provided database interface support is not uniform.

JSP: The technical completion of the Servlet is based on Java . So there are The biggest features of the Java language, namely platform-independent, once written, run anywhere.


The second concept: JSP is a dynamic Web technology standard advocated by Sun company.


1. Dynamic Content Templates

JSP is the insertion of a Java program segment into a traditional HTML file. In this section of the program can write some JDBC code to access the database, you can also send e-mail or as a remote EJB client to access the EJB server code, so as to achieve dynamic content updates.

2. Extending the HTML using custom Java code

JSP Essence is the dynamic update of a tag library, without restricting the code generated by hmtl,jsp can be HTML or other tag languages, such as various forms of XML.


3. Be compiled into Servlets

JSP is a simplified servlet design, which is essentially a servlet. In the development phase, JSP is a scripting language with a modular script as a text script. The runtime is compiled into a servlet format that performs the same life cycle as a servlet.


4. Work can be divided into content creation and program development.

JSP is an HTML or XML that can be developed using HTML or XML to develop JSPs. Dynamically implemented parts can be developed with a number of programs that are tagged with the JSP language itself, such as <%,%>, adding some built-in objects to the inside, adding some instructions, behaviors, and so on. The part that expands dynamic content.

How the JSP works: When the Web server encounters a request to access a JSP Web page, it executes the Java program segment, and then returns the execution result along with the HTML code in the JSP file to the client.


Features of JSP:

All of the JSP operations are performed on the server side, and only the resulting results are delivered to the client on the network, which greatly reduces the requirement for the client's browser, even if the client browser does not support the Java language and can access the JSP page. Therefore, Web applications developed with JSP are cross-platform and are not subject to the limitations of the operating system.


The difference between JSP and Servlet


The same point : both are executed on the server side, and the HTML text is returned to the client . As a result, the client can visit with a browser .


    different points :jsp was developed by the servlet, but the JSP does not add any functionality that the servlet cannot use. JSP only servlet designed to implement html syntax in java expands to <%,%> servlet therefore, in terms of structure, JSP is more embodied in the presentation layer, and the servlet is embodied in the business logic layer.


JSP implements the logic to display the content Separate from the logic of the business, the logic of the content is developed by the artist or by the person who maintains the interface, and the business logic is from the backend, such as database-related or EJB related to some of the business people to construct dynamic business processes.

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.