problem injecting Sessionscoped bean in Managed bean

Posted by user310852 on Stack Overflow See other posts from Stack Overflow or by user310852
Published on 2010-04-07T10:39:59Z Indexed on 2010/04/07 10:43 UTC
Read the original article Hit count: 459

Filed under:
|
|

I have a Session scoped bean

@SessionScoped
public class UserData implements Serializable {

private String uid;

public String getUid() {
    return uid;
}

public void setUid(final String uid) {
    this.uid = uid;
}

I'm setting a value in a SessionScoped bean in my stateless session bean

public void setOperator(final Operator operator) {
    userData.setUid(operator.getId());
}

When I try to get the object with @Inject I only get null

@ManagedBean(name = "RoleController")
@SessionScoped
public class RoleController {

...

@Inject
private UserData userData;

...

public UserData getUserData() {
    System.out.println("ID");
    System.out.println(userData.getUid());

I have a bean.xml

© Stack Overflow or respective owner

Related posts about java

Related posts about ejb