ASP.NET中DataGrid在JSP中的實現

來源:互聯網
上載者:User

ASP.NET中的DataGrid是非常方便的,而且也比較靈活,這段時間寫for webwork的介面UI,我就參照DataGrid寫了一個for jsp的Grid實現,個人認為,就使用來說 ,通過tag來實現的DataGrid比起ASP.NET的DataGrid無論從靈活性還是擴充性 來說,都一點也不遜色

下面是我的Grid實現方式

<cos:datagrid name="GridTest"  value="listObj" border="1" cellSpacing="12">
 <cos:template headText="模板列" headStyle="background-color: #66CCFF;cursor:hand">
  <cos:inputtext  name="timezone" value="name"/></td>
 </cos:template>
 <cos:column dataField="id" headText="編號" width="200" align="right" style="background-color: #66CCFF;cursor:hand"></cos:column>
 <cos:column dataField="name" headText="名稱"></cos:column>
</cos:datagrid>

使用起來比起.NET的DataGrid並沒有兩樣,我只定義了兩種列類型,模板列和繫結資料行,模板列可以放其他任何介面UI在裡面

列的值綁定通過value屬性來指定,由於是與webwork的整和,所以系統會首先在webwork中的ognl中尋找,實值型別必須為 Collection<?>,由於我是通過BeanUils來取值的,所以Collection中的元素可以包含多種類型

目前還沒有加分頁控制項進去,明天加上

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.