Hi I have been thinking about this one, and maybe there is a misunderstanding with @ManagedProperty annotation. That annotation is not servlet api, is in JSF or in java EE (i don't know which subset are you using). If is the JSF variant, note that annotation only works for managed beans, so you can't use it on other objects that are not instantiated by JSF.
The suggestion of Jakob should work. regards, Leonardo Uribe 2011/6/26 Jakob Korherr <[email protected]>: > Hi, > > Try using this: > > FacesContext facesContext = FacesContext.getCurrentInstance(); > YourBean yourBean = > facesContext.getApplication().evaluateExpressionGet(facesContext, > "#{yourBean}", YourBean.class); > > Regards, > Jakob > > 2011/6/26 Tobias Eisentrager <[email protected]>: >> Hello Group - this is my private email address. >> >> I have already asked this on >> http://stackoverflow.com/questions/6466783/access-another-managed-bean-in-jsf2-1-with-servlet-2-4 >> and have not gotten a sufficient answer yet. >> >> We have recently upgraded from JSF 1.2 to 2.1. We are running on >> WebSphere 6.1 which has Servlet 2.4 >> >> We are using the following libraries: myfaces 2.1.1 el-api-2.2 >> >> Now the only problem we have is that we cannot access the other >> Backing Beans like we did before with: >> >> public static Object getBackingBean( String pName ) { >> ELContext elContext = FacesContext.getCurrentInstance().getELContext(); >> Object ret = elContext.getELResolver().getValue(elContext, null, pName); >> return ret; >> } >> >> This will always return null. We have also tried: >> >> Beanclass bean = (Beanclass) >> FacesContext.getCurrentInstance().getApplication() >> .getELResolver().getValue(elContext, null, "beanclass"); >> >> which return null as well. >> >> We have tried the @ManagedProperty annotation but this is apparently a >> Servlet 2.5 feature. Is it possible that the ELContext uses DI now by >> default? Is there a way to get an Instance of another backing Bean in >> JSF2.1 and Servlet 2.4? >> >> Thanks! >> >> Toby >> > > > > -- > Jakob Korherr > > blog: http://www.jakobk.com > twitter: http://twitter.com/jakobkorherr > work: http://www.irian.at >

