The true face of JSP

Source: Internet
Author: User

JSP (Java Server pages) is a dynamic page technology whose main purpose is to separate logic from the servlet.
Learning the servlet technology model is the output of HTML in Java code, It is very complicated and confusing to write the required HTML tags in a row of out.println, until the JSP is contacted, not only the HTML is separated from Java, but also the Java code can be simplified.
The JSP page is almost the same as the HTML page, except for its own markup and a single line of header files.

<%@ page contenttype= "text/html;charset=gb2312"%>

have been very curious about how JSP is executing Java code in a Web page, and then in-depth understanding found that the JSP is actually a servlet, the project hangs on the Tomcat server access, JSP is compiled into a Java file, the dynamic execution of the command passed to the servlet, Finally, the HTML page output is displayed as static.
JSP tag Syntax:
<%! Java declaration%>, used to declare variables and define methods
<%java code%> the Java code used to execute the business logic
<%= expression%>, which is used to output the value of an expression in a JSP page
<%@ instruction%>, specifies the instruction that the item container sends when the conversion occurs, and this is the JSP header file.
<%– any text –%>, for document annotations
JSP many implied variables make the code more convenient, such as the out variable, printing freely, because the JspWriter class extends the java.iowriter, in the execution of the automatic import of the package.


The true face of JSP

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.