JSP programming (II)-JSP basic syntax (3)-expressions

Source: Internet
Author: User

Contains an expression that complies with the JSP syntax.

JSP syntax

<% = Expression %>

Example

<Font color = "blue"> <% = map. Size () %> </font>
<B> <% = numguess. gethint () %> </B>.

Description

The expression element represents an expression defined in the script language. It is automatically converted to a string after running, and then inserted into the expression for display at the location of the JSP file. Because the value of this expression has been converted into a string, you can insert this expression in a line of text (in the same form as ASP ).

When using expressions in JSP, remember the following:

You cannot use a semicolon (";") as the expression Terminator. But the same expression must end with a semicolon when used in scriptlet! View the scriptlet expression element that can include any valid expressions in Java language specification.

Sometimes expressions can also be used as attribute values of other JSP elements. An expression can become very complex and may consist of one or more expressions. The order of these expressions is from left to right. 

Related Article

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.