我已经创建了我想在构造函数/后构造函数中初始化的 FacesComponent。问题是那里getAttributes()
是空的。下面是示例。
@FacesComponent("articleComponent")
public class ArticleFacesComponent extends UINamingContainer {
private Article article;
public ArticleFacesComponent() {
Object idObj = getAttributes().get("articleId"); // I want to get article id to initialize object but getAttributes() is empty
...
article = em.find(Article.class, id);
}
}