BBS水木清华站∶精华区

发信人: agents (智能代理), 信区: Java        
标  题: JSP语法(9) 
发信站: BBS 水木清华站 (Tue Jan  2 14:51:19 2001) 
 
 
【<jsp:getProperty>】 
   Gets the value of a Bean property so that you can display it in a result  
   page. 
 
▲ [JSP Syntax] 
 
<jsp:getProperty name="beanInstanceName"  property="propertyName" /> 
 
▲ [Examples] 
 
<jsp:useBean id="calendar" scope="page" class="employee.Calendar" /> 
<h2> 
Calendar of <jsp:getProperty name="calendar" property="username" /> 
</h2> 
 
▲[Description] 
 
You must create or locate a Bean instance with <jsp:useBean> before you use  
<jsp:getProperty>. 
 
The <jsp:getProperty> tag gets a Bean property value using the property's  
get method, converts the value of a Bean property to a String and stores it  
in the out object. 
 
In JSP 1.0, <jsp:getProperty> has a few limitations you should be aware of: 
(1)You cannot use <jsp:getProperty> to retrieve the values of an indexed  
property. 
(2)You can use <jsp:getProperty> with JavaBeans components, but not with enterp 
rise beans. You can get around this limitation by writing a JSP application  
in which a JSP file gets values from a Bean, and the Bean in turns calls an  
enterprise bean. 
▲[Attributes] 
 
(1)name="beanInstanceName" 
The name of the Bean instance as declared in a <jsp:useBean> tag. 
(2)property="propertyName" 
The name of the Bean property whose value you want to display. 
 
-- 
 
※ 修改:·agents 於 Jan  2 16:39:30 修改本文·[FROM:   166.111.54.22] 
※ 来源:·BBS 水木清华站 smth.org·[FROM: 166.111.54.22] 

BBS水木清华站∶精华区