Adding composite component programmatically

元气小坏坏 提交于 2019-12-06 00:14:23

The includeCompositeComponent() returns an UIComponent instance representing the composite implementation.

UIComponent composite = Components.includeCompositeComponent(someParentComponent, libraryName, resourceName, id);

All of its attributes are available as a Map by UIComponent#getAttributes().

Map<String, Object> attributes = composite.getAttributes();

You can use Components#createMethodExpression() to create an EL method expression. Assuming that you intend to specify #{bean.complete}, here's an example:

MethodExpression autoCompleteMethod = Components.createMethodExpression("#{bean.complete}", List.class, String.class);

Now, just set it as attribute!

attributes.put("autoCompleteMethod", autoCompleteMethod);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!