隨筆-204  評論-90  文章-8  trackbacks-0
          Logic Tags

          語法應(yīng)用是 --
          <someComparisonTag value="someUserNameValue" cookie="userName"> (cookie specifies the name of the cookie to compare with value)
          <someComparisonTag value="en_US" header="Accept-Language"> (header specifies the name of the HTTP header to compare with value)
          <someComparisonTag value="someUserNameValue" parameter="username"> (parameter specifies the name of the request parameter to compare with value)

          <someComparisonTag name="testBean" property="propNameInTestBean" value="someValue"> (典型)
          name指定了bean的名字而property指定了該bean的某個property以便于與value比較, 通常我們還可以加一個scope來限制bean
          property is used in conjunction with name to specify a property in the bean specified by name. The property reference can be simple, nested, and/or indexed. For the type of syntax used for property, see the users guide on the Bean Tags.
          scope specifies the bean scope which can be page, request, session, application, "any scope" (default)

          1) 值比較 Value Comparison: equal, notEqual, greaterEqual, lessEqual, lessThan, greaterThan
          比較邏輯是 -- 先試圖convert成long double,并比較; 如果parse失敗就會用String.equalTo()來比較

          1) 值比較 Value Comparison: present, notPresent, empty, notEmpty
          present看的是某變量/實例是否存在于某個限定范圍,empty看的是該實例是否為null, "", or collection.isEmpty()==true (only for collection)

          2) 子字符串匹配 Substring Matching: match, notMatch
          match/notMatch 還有一個可選location來指定該substring必須出現(xiàn)在字符串開始還是結(jié)尾 (location="start/end")

          3) Presentation Location: forward, redirect
          用法尚不清楚

          4) Collection Utilities: iterate (極常用)
          <logic:iterate id="searchResultList" name="<%=WebKeys.SEARCH_RESULT_LIST_TWO%>" scope="session">
          <bean:write name="searchResultList" property="itemName"/></a>
          <bean:write name="searchResultList" property="itemUnitOfMeasure" />
          <bean:write name="searchResultList" property="inventoryDetailSize" format="#0.00"/>
          </logic:iterate>
          如果property給定,name代表了一個bean的實例,而這個bean的getThatProperty()將返回此tag需要的collection實例,
          如果沒有給定property, name本身就指定了將被iterate的collection的實例,
          id給出了每一次循環(huán)的collection的當(dāng)前object的名字,用于在內(nèi)部使用
          offset和length指定了從collection的哪個位置開始,到哪里結(jié)束,其他請參見Struts Documentation,這里不詳述
          posted on 2006-02-23 16:37 一凡 閱讀(298) 評論(0)  編輯  收藏 所屬分類: JAVA FRAMEWORK

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 大理市| 福州市| 江陵县| 若尔盖县| 板桥市| 平江县| 华亭县| 张家界市| 盐源县| 赤城县| 合江县| 田阳县| 宝鸡市| 昂仁县| 清河县| 西宁市| 日喀则市| 西畴县| 康定县| 眉山市| 莱阳市| 利辛县| 霍林郭勒市| 将乐县| 扶余县| 贵南县| 涟源市| 保德县| 日喀则市| 东明县| 古浪县| 井研县| 霸州市| 五河县| 宣威市| 孟村| 偏关县| 福鼎市| 茶陵县| 忻城县| 商水县|