Basic JSP syntax knowledge

Source: Internet
Author: User

Basic JSP syntax knowledge

1. JSP comments

Comments in JSP are classified into two categories:

Explicit comment: (Increase the transmission burden and minimize the usage)
Implicit comment:
Format 1: // single line comment
Format 2:/**/single-line or multi-line comment
Format 3: <% -- JSP annotation, invisible to the client -- %> JSP Annotation
Example:
Compile a JSP file that contains the preceding three annotations

Signature + signature/Signature + oaLJ + signature/Cw + signature + CjwvcD4KPHA + signature + sLrJT48YnI + CjwvcD4KPHA + signature ++ signature/Signature + signature + sLru + signature + Cw + csn5w/e3vbeoo6zL + dLUsrvE3NTa0KG9xbG + large/cjno7o8L3A + large/small = "http://www.2cto.com/uploadfile/Collfiles/20150104/20150104091250243.png" alt = "\">


(2) Declaration: <%! Method %>

Compile defines global constants, writing method, but cannot be directly in <%! %> Write any common statement in it because this section is JSP
The engine is converted into a method in the class.
Note: JSP built-in objects cannot be used in this part.

For example:
Declare a method for formatting the date and call it to display the current date.




(3) expression: <% = %>

Outputs a variable or specific content.

For example:
Use out. print () and expression to print ten rows and ten columns of tables on the page. which method is better.
Out. print () output:



Expression output: it is more concise and the front-end code is more regular. Therefore, this method is recommended.





















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.