我試圖建立一個豐富的建議,我不明白爲什麼輸入值爲空... 我的意思是,爲什麼我輸入的東西時不會採取inputText值。豐富的建議 - 爲什麼輸入爲空? (縫框架)
的.xhtml代碼:
<h:inputText value="#{suggestion.input}" id="text">
</h:inputText>
<rich:suggestionbox id="suggestionBoxId" for="text" tokens=",[]"
suggestionAction="#{suggestion.getSimilarSpacePaths()}" var="result"
fetchValue="#{result.path}"
first="0"
minChars="2"
nothingLabel="No similar space paths found"
columnClasses="center"
>
<h:column>
<h:outputText value="#{result.path}" style="font-style:italic"/>
</h:column>
</rich:suggestionbox>
和動作類:
@Name("suggestion")
@Scope(ScopeType.CONVERSATION)
public class Suggestion {
@In
protected EntityManager entityManager;
private String input;
public String getInput() {
return input;
}
public void setInput(final String input) {
this.input = input;
}
public List<Space> getSimilarSpacePaths() {
List<Space> suggestionsList = new ArrayList<Space>();
if (!StringUtils.isEmpty(input) && !input.equals("/")) {
final Query query = entityManager.createNamedQuery("SpaceByPathLike");
query.setParameter("path", input + '%');
suggestionsList = (List<Space>) query.getResultList();
}
return suggestionsList;
}
}
所以,輸入beeing空,suggestionList總是空... 爲什麼輸入的值沒有發佈?
不幸的是,沒有。該方法名稱是可以的,因爲在調試模式下,該方法成功地被「捕獲」。 – 2010-06-14 08:00:58