java - @Inject is injecting a new instance every time i use it -
i have following issue. (jboss 7.1 as, jsf 2 , myfaces extension filter)
two managed beans. (i have cleaned code). want retrieve loginbean nextbean. problem every time inject bean new instance of loginbean , not current one. have tried things @named("name"). bean (both) invoked jsf pages , data set, new instance injected every time , cant figure out i'm doing wrong!!!
@named @sessionscoped public class loginbean implements serializable { private static final long serialversionuid = -8825740128333470396l; @ejb private userdetaildao userdetaildao; private string description; public string getdscription() { return description; } public string submit() { userdetaildao.dosomething("test"); description = "testing"; return "next.xhtml"; } }
and second bean
@named @sessionscoped public class nextbean extends somebean implements serializable { private static final long serialversionuid = -4654827059950265300l; @inject private loginbean loginbean; public string submit() { string description = loginbean.getdscription(); return "login.xhtml"; } }
the "description" set , can see in jsf page, cant access nextbean since injects new instance every time! data in session!
:/
any tips? in advance!
i naming beans wrong! , did not use proper @produces :/
thanks time lads.
Comments
Post a Comment