posts - 9,  comments - 1,  trackbacks - 0
          jsp
          JSP語法(9)——jsp:getProperty

          <jsp:getProperty>

          獲取Bean的屬性值,用于顯示在頁面中

          JSP 語法

          <jsp:getProperty name="beanInstanceName" property="propertyName" />

          例子

          <jsp:useBean id="calendar" scope="page" class="employee.Calendar" />

          <h2>

          Calendar of <jsp:getProperty name="calendar" property="username" />

          </h2>

          描述

          這個<jsp:getProperty>元素將獲得Bean的屬性值,并可以將其使用或顯示在JSP頁面中.在你使用<jsp:getProperty>之前,你必須用<jsp:useBean>創建它.

          <jsp:getProperty>元素有一些限制:

          你不能使用<jsp:getProperty>來檢索一個已經被索引了的屬性

          你能夠和JavaBeans組件一起使用<jsp:getProperty>,但是不能與Enterprise

          Bean一起使用。

          屬性

          name="beanInstanceName"
          bean的名字,由<jsp:useBean>指定

          property="propertyName"
          所指定的Bean的屬性名。

          技巧:

          在sun的JSP參考中提到,如果你使用<jsp:getProperty>來檢索的值是空值,那么NullPointerException將會出現,同時如果使用程序段或表達式來檢索其值,那么在瀏覽器上出現的是null(空).



          jsp:getProperty Action

          語法:

            <jsp:getProperty name="beanInstanceName" property="propertyName" />

            這個屬性檢索出bean的屬性的值并將之轉化為一個字符串,然后將之插入到輸出。它有兩個必選屬性:name,在之前用jsp:useBean引入的名稱,property,必須被插入值的屬性。

          posted on 2006-09-21 13:46 lovetq 閱讀(166) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 古蔺县| 宝山区| 澄城县| 义马市| 绩溪县| 朝阳县| 兴安盟| 霍州市| 登封市| 崇左市| 景德镇市| 天镇县| 霞浦县| 遂溪县| 雷州市| 云梦县| 中方县| 宜宾市| 奉新县| 泰和县| 包头市| 凉城县| 万源市| 河南省| 长治县| 永仁县| 明水县| 故城县| 南川市| 游戏| 邛崃市| 潞城市| 芦山县| 鸡泽县| 嵊州市| 阿拉善盟| 台山市| 盈江县| 循化| 仁寿县| 右玉县|