Originally posted by Ryan Lubke:
Say your application scoped managed bean is called 'app'.
Then in your session managed bean definition you'd:
When 'sessBean' is instaniated by JSF, the application scoped bean will
be injected into the instance. You need to make sure there is public property accessors for this to work of course.
Hello,
I did it as you suggested but it did'nt work, I am posting my code probably i missed something
Faces-Config.xml
<faces-config xmlns="http://java.sun.com/JSF/Configuration">
<managed-bean>
<managed-bean-name>backing_index</managed-bean-name>
<managed-bean-class>view.backing.Index</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>Test</property-name>
<value>#{Testing}</value>
</managed-property>
</managed-bean> <managed-bean>
<managed-bean-name>backing_content</managed-bean-name>
<managed-bean-class>view.backing.Content</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/content.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>Testing</managed-bean-name>
<managed-bean-class>view.backing.Testing</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
</faces-config>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
and for the accessors
public void setTest(Testing test) {
this.Test = test;
//System.out.println("Session Bean Injectd with Test"+Test.result);
}
public Testing getTest() {
return Test;
}
but then i kept getting this error
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
javax.servlet.jsp.JspException: javax.faces.FacesException:
javax.faces.FacesException: Can't set managed bean property: 'Test'.at com.sun.faces.taglib.html_basic.FormTag.doStartTag(FormTag.java:355)at _index._jspService(_index.java:60)[/index.jsp