سؤال

I have beans

@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;
}

I want to HistoryBean was created only once, but it creates on each request(?) with clean state. What did I do wrong?

هل كانت مفيدة؟

المحلول

Trouble was in wrong annotation imports. You need to use annotation which are from javax.faces.bean package.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top