Frage

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?

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top