I have this code for a backing bean:
@PostConstruct
public void refreshData()
{
rows = (int) dd.getRows();
pages = dd.getPages();
getRender();
}
// action
public void getCount(String sql, Object... values)
throws Exception
{
dd.getCount(sql, values);
rows = (int) dd.getRows();
pages = dd.getPages();
}
// getter methods
public boolean getRender() {
System.out.println("pages: "+pages);
boolean rendered = pages > 0? true: false;
return rendered;
}
public int getRows() {
return rows;
}
public int getPages() {
return pages;
}
Does the refreshData() method with the @PostConstruct directive get executed after or before all the getter methods? I ask this because I notice the getRender() method always return zero even though the getPages() returns a number like 10 for example.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…