DataTable コンポーネントで convertDateTime タグを使用しています。マネージド Bean プロパティが timezone 属性に接続されました。この状況では、すべての ajax が Managed Bean の再作成を要求します。
Managed Bean のスコープは View Scoped です。
<h:column>
<f:facet name="header">
<h:outputLabel value="Date"/>
</f:facet>
<h:outputText value="#{item.date}">
<f:convertDateTime timeZone="#{myBean.timezone}" locale="tr" pattern="dd.MM.yyyy"/>
</h:outputText>
</h:column>
@ManagedBean(name="myBean")
@ViewScoped
public class MyBean {
@PostConstruct
public void initBeanMethod(){
System.out.println("PostConstruct method is called...");
}
private TimeZone timezone = TimeZone.getDefault();
public TimeZone getTimezone() {
return timezone;
}
public void setTimezone(TimeZone timezone) {
this.timezone = timezone;
}
各 ajax リクエストの後に次の出力を表示します: "PostConstruct メソッドが呼び出されます..."
各リクエストでの Bean の再作成についてのアイデアはありますか?
注:下手な英語で申し訳ありません:)