I have my application configured like the following
faces-config.xml
....
<application>
<variable-resolver>org.springframework.web.jsf.DelegatingVar iableResolver</variable-resolver>
</application>
<managed-bean>
<description>
Search bean
</description>
<managed-bean-name>Search</managed-bean-name>
<managed-bean-class>search.action.SearchAction</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>company</property-name>
<value>#{companyDAO}</value>
</managed-property>
</managed-bean>
....
applicationContext.xml
....
<bean id="companyDAO" class="search.pojo.CompanyBean">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
...
and while running it gives error
ERROR [ApplicationImpl] Managedbean Search could not be created Expression Error: Named Object: 'companyDAO' not found.
javax.faces.el.EvaluationException: Expression Error: Named Object: 'companyDAO' not found.
at com.sun.faces.config.ManagedBeanFactory.getScopeFo rSingleExpression(ManagedBeanFactory.java:998)
at com.sun.faces.config.ManagedBeanFactory.hasValidLi fespan(ManagedBeanFactory.java:931)
at com.sun.faces.config.ManagedBeanFactory.evaluateVa lueBindingGet(ManagedBeanFactory.java:892)
and when i remove the managed-property and lookup the spring bean like below it is working
ServletContext context = (ServletContext)FacesContext.getCurrentInstance(). getExternalContext().getContext();
ApplicationContext appContext = WebApplicationContextUtils.getRequiredWebApplicati onContext(context);
this.company = (CompanyBean)appContext.getBean("companyDAO");
where i am going wrong ? please help


Reply With Quote