2017年2月23日 星期四

如何對 Datatable 上的某一個資料列進行編輯? - 使用 p:dataTable 元件



原理:
1. 利用 p:dataTable 中的 selection 屬性取得目前選擇的物件. selection 屬性要和 Managed Bean 的 property 綁在一起.
2. 設計一個 UI 提供使用者輸入新的資料. 這個 UI 可以是 Dialog, 也可以是 Page. 此 UI 的輸入元件會取得先前 Managed Bean Property 的資料並何其繫結在一起.
3. 在 Managed Bean 提供一個方法, 例如 saveDB(), 呼叫 EJB 的方法, 將修改後的資料儲存到資料庫中.

2017年2月7日 星期二

Defining relative clause 和 non-defining relative clause 間的用途差別


Defining relative clause 和 non-defining relative clause 間的使用方式有什麼不同呢?
參考此 youtube

My brother, who is a policeman, lives in New York.
我只有一個哥哥,現在住在 New York. 使用 non-defining relative clause, 因為不用特別限定我所要描述的規格。

My brother who is a policeman lives in New York.
我有兩個哥哥,當警察的那個現在住在 New York。使用 defining relative clause 限定我所要描述的其中一個哥哥。

來個 Quiz:
5 things about non-defining relative clauses