[英]Programmatically adding JSF components without binding to backing bean property
我直接从 bean 以编程方式添加一些 uiinput 组件,如下所示:
UIInput uiField = (HtmlInputText) application.createComponent(HtmlInputText.COMPONENT_TYPE);
uiField.setId(fieldId);
请注意,我不想将此组件绑定到任何 bean 属性。
问题是,当通过 id 检索组件时,即使在表单中填充字段并提交表单后,该值也始终为 null。
UIInput uiField = (UIInput) facesContext.getViewRoot().findComponent(fieldId);
String value = uiField.getValue().toString(); //null
请指教。
我发现我必须将组件放入表单中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.