rich suggestions - why input is null? (seam framework)

Posted by Cristian Boariu on Stack Overflow See other posts from Stack Overflow or by Cristian Boariu
Published on 2010-06-11T14:12:57Z Indexed on 2010/06/15 7:32 UTC
Read the original article Hit count: 326

Filed under:
|
|
|

Hi, I'm trying to build a rich suggestions and i do not understand WHY the input value is null... I mean, why inputText value is not taken when i enter something.

The .xhtml code:

<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>

and action class:

@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;
}

}

So, input beeing null, suggestionList is always empty... Why input's value is not posted?

© Stack Overflow or respective owner

Related posts about java

Related posts about jsf