Normally, this would be no problem, because I would define a managed-bean in
the faces-config.xml and use the createValueBinding-Method from the
ApplicationFactory to bind my JSF-Input-components to the attribute values
of my Bean.
The problem now is: I want to create an independent JSF-component which
should be deployed in a JAR-file and which should be usable in any
JSF-Web-Application without adding specific managed-beans to the local
faces-config.xml. Therefore I need to dynamicly create a managed bean from
my "BaseProperty"-class during runtime.
Why not adding the MB to the faces-config of your component's
faces-config.xml file?
I think about something like
createManagedBean("temporaryBean", "
de.rub.swt.csseditor.model.BaseProperty", "session");
ValueBinding dynBinding =
myApplicationFactory.createValueBinding("temporaryBean.name");
cssAttributeNameInput.setValue(dynBinding);
Is this possible? What must be the content of
public void createManagedBean(String managedBeanName, String
managedBeanClass, String scope)
{
// ???????????
}
A managed bean is just a simple javaBean which can be looked up from
the VariableResolver. The method resolveVariable(faces_context,
name_of_my_bean) goes through all the scopes and looks it up & returns
the bean than. Or create's it using the ManagedBeanBuilder, if not
attached to any scope yet.
So why not just creating a new object and storing it under the needed context ?
like fc.getExternalContext().getSessionMap().put("fooBean", obj");
-Matt
Any hints or ideas?
Greetings,
Hendrik
--
Matthias Wessendorf
further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com