Jsf rich:suggestionbox错误-this.element为null
我正在尝试使用rich:suggestionbox。我浏览了Richfaces提供的教程。重要的是我使用的是Richfaces 3.1.4 JAR。在建议框中,我只是尝试在开始时填充一些默认数据,但建议框根本没有呈现。当我尝试在Firefox中查看错误控制台时,会显示以下错误消息: 错误:此.element为空 源文件:http://localhost:9080/sample/a4j_3_1_4.GAorg/richfaces/renderkit/html/scripts/suggestionbox.js.faces 线路:2 JSF代码 豆角 请提供帮助。编辑:更改代码后: 按如下方式更改方法inputData: 当然,我认为您需要根据建议字符串调整inputdataJsf rich:suggestionbox错误-this.element为null,jsf,richfaces,Jsf,Richfaces,我正在尝试使用rich:suggestionbox。我浏览了Richfaces提供的教程。重要的是我使用的是Richfaces 3.1.4 JAR。在建议框中,我只是尝试在开始时填充一些默认数据,但建议框根本没有呈现。当我尝试在Firefox中查看错误控制台时,会显示以下错误消息: 错误:此.element为空 源文件:http://localhost:9080/sample/a4j_3_1_4.GAorg/richfaces/renderkit/html/scripts/suggestionb
public List<Capital> inputData(Object suggest) {
String pref = (String)suggest;
//if (suggest...) - add this! to complete according the word
ArrayList<SelectedList> inputData = new ArrayList<SelectedList>();
inputData.add(new SelectedList("1","equal"));
inputData.add(new SelectedList("2","not equal"));
inputData.add(new SelectedList("3","greater"));
inputData.add(new SelectedList("4","lesser"));
return inputData;
}
您需要将其更改为:fetchValue={result.value},其中value在SelectedList中有一个getter方法
如果您缺少它,它将不会显示
请参见您正在使用哪个jsf版本的示例?很抱歉,这是一个输入错误,而不是我在jsf代码中键入的填充数据。我有默认生成的getter和setter方法,这就是我在代码中提到getter和setter以减少空间的原因。你不需要用getter和setter。
enter code here
private List<SelectedList> inputData; // Setter
private String selectedData; // Getter and Setter
public List<SelectedList> getInputData() { //Getter
if(inputData!=null){
inputData = new ArrayList<SelectedList>();
inputData.add(new SelectedList("1","equal"));
inputData.add(new SelectedList("2","not equal"));
inputData.add(new SelectedList("3","greater"));
inputData.add(new SelectedList("4","lesser"));
}
return inputData;
}
public List<Capital> inputData(Object suggest) {
String pref = (String)suggest;
//if (suggest...) - add this! to complete according the word
ArrayList<SelectedList> inputData = new ArrayList<SelectedList>();
inputData.add(new SelectedList("1","equal"));
inputData.add(new SelectedList("2","not equal"));
inputData.add(new SelectedList("3","greater"));
inputData.add(new SelectedList("4","lesser"));
return inputData;
}
fetchValue="#{basic.selectedData}"