Oracle ADF Jdev Ver:11.1.1.4
我的要求是创建一个输入字段,我可以在其中提供自动建议,用户可以输入多个电子邮件ID。在Gmail中撰写邮件时,它类似于当前的“收件人”字段。
问题: 我已经实现了带有自动建议的输入框。对于第一个条目,它工作正常。当我输入第二个值时(我使用','(逗号)作为分隔符并在'suggestItems'bean方法中处理它以在逗号之后提取子字符串以提供建议),在选择之后....第一个值丢失。因此,在输入文本中只选择一个值。
输入文字:
<af:inputText label="Names" id="it21" rows="2"
columns="50" simple="true"
valueChangeListener="#{VisitBackingBean.visitMembersInputBoxCL}"
binding="#{VisitBackingBean.visitMembersInputBox}">
<af:autoSuggestBehavior suggestItems="#{VisitBackingBean.onSuggest}"/>
</af:inputText>
Bean方法:
public List onSuggest(FacesContext facesContext,
AutoSuggestUIHints autoSuggestUIHints) {
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
String inputNamevalue = autoSuggestUIHints.getSubmittedValue().trim();
if(inputNamevalue.contains(",")) {
inputNamevalue = inputNamevalue.substring(inputNamevalue.lastIndexOf(",")+1).trim();
}
//create suggestion list
List<SelectItem> items = new ArrayList<SelectItem>();
// if (autoSuggestUIHints.getSubmittedValue().length() > 3) {
// }
OperationBinding setVariable =
(OperationBinding)bindings.get("setnameSearch");
setVariable.getParamsMap().put("value",
inputNamevalue);
setVariable.execute();
//the data in the suggest list is queried by a tree binding.
JUCtrlHierBinding hierBinding =
(JUCtrlHierBinding)bindings.get("AutoSuggestName_TUserROView1");
//re-query the list based on the new bind variable values
hierBinding.executeQuery();
//The rangeSet, the list of queries entries, is of type //JUCtrlValueBndingRef.
List<JUCtrlValueBindingRef> displayDataList =
hierBinding.getRangeSet();
for (JUCtrlValueBindingRef displayData : displayDataList) {
Row rw = displayData.getRow();
//populate the SelectItem list
items.add(new SelectItem(rw.getAttribute("UsrUserName").toString().trim() +
"<"UsrMailId").toString().trim() +
">",
rw.getAttribute("UsrUserName").toString().trim() +
"<" +
rw.getAttribute("UsrMailId").toString().trim() +
">"));
}
return items;
}
请建议我如何实现上述功能。