我有豆子
@ManagedBean(name="HistoryBean")
@ApplicationScoped
public class HistoryBean
{...}
@ManagedBean(name="ViewBean")
@ApplicationScoped
public class ViewBean
{
public void setHistoryBean(HistoryBean historyBean)
{this.historyBean = historyBean;}
@ManagedProperty(value="#{HistoryBean}")
private HistoryBean historyBean;
}
我希望HistoryBean只创建一次,但它会在每个请求(?)上创建干净状态。我做错了什么?
答案 0 :(得分:0)
麻烦在于错误的注释导入。您需要使用来自javax.faces.bean包的注释。