隨筆-4  評論-4  文章-1  trackbacks-0
            2007年11月4日
          <html:select       property="personnelId">         
                       <html:option   value="">請選擇</html:option>         
                       <html:options collection="personList"  property="personId"   labelProperty="personName"/>             
          </html:select>        
                html:options自動幫你迭代personList中的內容,前提是personList是Collection類型的,而且封裝的是一個包含personId,personName屬性的對象        
                property顯示的是value,labelProperty顯示的是頁面看到的內容  
          posted @ 2007-11-04 21:59 溫娜 閱讀(396) | 評論 (0)編輯 收藏
            2007年10月28日

          <logic:present name="result">
                  <logic:iterate id="book" name="result">
                       <logic:present name="book">
                           <tr>
                               <td><bean:write name="book" property="name" /></td>
                               <td><bean:write name="book" property="author" /></td>
                               <td><bean:write name="book" property="price" /></td>
                            </tr>
                        </logic:present>
                   </logic:iterate>
          </logic:present>

          <logic:present name="result" scope="session">這里有個scope屬性可能是request,session等,name指的是一個對象,可能是javaBean,也可能是集合的對象,整個意思就是就是在scope(session,request)范圍里面查找name(一個對象)是否存在,相當于一個if()語句.

          posted @ 2007-10-28 21:33 溫娜 閱讀(400) | 評論 (0)編輯 收藏

          一是定義新字符串常量:

          <bean:define id="foo" value="This is a new String"/>
          <bean:define id="bar" value='<%= "Hello, " + user.getName() %>'/>
          <bean:define id="last" scope="session" value='<%= request.getRequestURI() %>'/>


          二是復制一個現有的bean給新的bean:

          <bean:define id="foo" name="bar"/>
          <bean:define id="baz" name="bop" type="com.mycompany.MyClass"/> //定義腳本變量的類型,默認為Object


          三是復制一個現有的bean的屬性給新的bean:

          <bean:define id="bop" name="user" property="role[3].name"/>
          <bean:define id="foo" name="bar" property="baz" scope="request" toScope="session"/>
          //toScope屬性指新bean的scope,默認為page

          上段代碼的意思是把名為bar的bean的baz屬性賦值給foo,foo的類型為String(默認)。

          posted @ 2007-10-28 21:31 溫娜 閱讀(2738) | 評論 (0)編輯 收藏

          如下例:
           <logic:equal name="map" property="key" value="${list.moduleId}">
                <td>     
                    <html:multibox property="powersId" value="${list.powerId}">
                    </html:multibox>
                    <bean:write name="list" property="powerChinese"/>
               </td>
           </logic:equal>
           如果map的屬性key值為${list.moduleId},則執行:
               <td>     
                    <html:multibox property="powersId" value="${list.powerId}">
                    </html:multibox>
                    <bean:write name="list" property="powerChinese"/>
               </td>

          posted @ 2007-10-28 21:28 溫娜 閱讀(4666) | 評論 (2)編輯 收藏
          僅列出標題  
          主站蜘蛛池模板: 雷州市| 镇巴县| 南康市| 安义县| 杭锦旗| 兴国县| 上栗县| 栾城县| 琼结县| 寿宁县| 满城县| 威信县| 武夷山市| 彰化市| 阿拉尔市| 墨脱县| 阜阳市| 墨江| 上栗县| 措勤县| 西藏| 濉溪县| 绵竹市| 晴隆县| 乌鲁木齐县| 浮山县| 高淳县| 六安市| 五莲县| 清镇市| 会理县| 浠水县| 修武县| 湘阴县| 石狮市| 原平市| 天祝| 津市市| 康保县| 洪雅县| 诏安县|