Contents | Prev | Next


Expression

Contains an expression valid in the scripting language used in the JSP page.

JSP Syntax

<%= expression %>

XML Syntax

<jsp:expression>	
   expression	
</jsp:expression>

Examples

The map file has <font color="blue"><%= map.size() %></font> entries.

Good guess, but nope. Try 	
<b><jsp:expression>numguess.getHint()</jsp:expression></b>.

Description

An expression element contains a scripting language expression that is evaluated, converted to a String, and inserted into the response where the expression appears in the JSP page. Because the value of an expression is converted to a String, you can use an expression within a line of text, whether or not it is tagged with HTML, in a JSP page.

The expression element can contain any expression that is a valid page scripting language. When the Java programming language is the scripting language you do not use a semicolon to end the expression. However, the same expression within a scriptlet requires the semicolon; see Scriptlet).

You can sometimes use expressions as attribute values in JSP elements (see the JavaServer Pages Syntax Card). An expression can be complex and composed of more than one part or expression. The parts of an expression are evaluated in left-to-right order.

See Also



Contents | Prev | Next

Copyright © 2002, Sun Microsystems, Inc. All rights reserved.