所以我创建了一个复合组件 FileAdder.xhtml
<composite:interface>
<composite:attribute name="type" value="#{editoriCompositeController.typeString}"/>
</composite:interface>
<composite:implementation>
<h:form>
<p:editor id="editor" widgetVar="editorWidget" value="some text" width="600" />
</h:form>
</composite:implementation>
然后我有一个EditoriCompositeController ManagedBean:
@ViewScoped
@ManagedBean
public class EditoriCompositeController {
String typeString;
public void setTypeString(String typeStringParameter) {
this.typeString = typeStringParameter;
}
public String getTypeString() {
return typeString;
}
}
然后在我的fileattachmentsview.xhtml文件中,我使用了这个组件:
<owncomponents:fileadder type="MEMO" />
但是这并没有将后备 bean 的 typeString 值设置为“MEMO”。它仍然为空,我用一个打印值的按钮进行了测试。
我该如何让后备 bean 获取我在组合组件的类型属性中设置为“MEMO”的 typeString 值?为什么它是 null 而不是“MEMO”?