0

This was asked in a previous question (http://stackoverflow.com/questions/6043259/auto-instantiate-a-session-bean). I implemented the solution offered by BalusC but it isn't working. This is my code:

@ManagedBean
@SessionScoped
public class UserSessionBean {

AND

@ManagedBean
@ViewScoped
public class ReaderBean implements Serializable {

@ManagedProperty("#{userSessionBean}")
private UserSessionBean userSessionBean;

If I understand BalusC correctly, JSF should auto-instantiate the session bean. In my case I get error saying that ReaderBean cannot be instantiate because no instance of UserSessionBean exists. So how can I get JSF to manage the instantiation for me? Manually instantiating and putting to the session map is supposedly a hack/workaround, so I'd like to avoid it.

4

1 に答える 1

1

答えがわかりました。

管理プロパティには、Getter メソッドと Setter メソッドが必要でした。

于 2012-10-08T05:01:42.357 に答える