Вопрос

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