I have been working on writing a servlet for AJAX/JSON.
I want to reference my @ManagedBeans by name. I basically want to do the mapping between:
http://host/app/myBeanName/myPropertyName
and-
@ManagedBean(name="myBeanName")
public class MyBeanName {
public String getMyProperty();
}
Can I load a bean by name from a regular servlet? Or if there is a JSF servlet or helper I could use for it please tell me about it?
Yes if you have your bean in request scope then from servlet
@RequestScopeif it is in session scope
@SessionScopedfor application scoped bean
@ApplicationScope