BBS水木清华站∶精华区

发信人: agents (智能代理), 信区: Java        
标  题: JSP语法(4) 
发信站: BBS 水木清华站 (Tue Jan  2 14:47:39 2001) 
 
4 【Expression】   
Contains an expression valid in the scripting language used in the page. 
 
▲[JSP Syntax] 
 
<%= expression %> 
 
▲ [Examples] 
 
The map file has <font color="blue"><%= map.getCount() %></font> entries. 
 
Good guess, but nope. Try <b><%= numguess.getHint() %></b>. 
 
▲ [Description] 
 
  An expression tag contains a scripting language expression that is evaluated,  
converted to a String, and inserted where the expression appears in the JSP  
file. Because the value of an expression is converted to a String, you can 
use an expression within text in a JSP file. 
 
When you use the Java language for scripting, remember these points: 
(1) You cannot use a semicolon to end an expression (however, the same  
    expression within scriptlet tags requires the semicolon; see Scriptlet). 
(2) The expression tag can contain any expression that is valid according to  
    the Java Language Specification. 
(3) You can sometimes use expressions as attribute values in JSP tags  
   (see the JavaServer PagesTM Syntax Card).  
(4) If an expression has more than one part, the parts are evaluated in  
    left-to-right order as they appear in the tag. 
 
-- 
 
※ 修改:·agents 於 Jan  2 15:26:03 修改本文·[FROM:   166.111.54.22] 
※ 来源:·BBS 水木清华站 smth.org·[FROM: 166.111.54.22] 

BBS水木清华站∶精华区