JSF javax.servlet.ServletException:未找到方法:类实体

JSF javax.servlet.ServletException:未找到方法:类实体,java,jsf,servlets,jsf-2,Java,Jsf,Servlets,Jsf 2,我想知道如何从entity Consumble.java调用这个函数anystock,并在xhtml上使用它 public String anystock(int value) { String result = null; if (value==0) { result="Please fill the stock of this device"; } else if (value<5) { resul

我想知道如何从entity Consumble.java调用这个函数anystock,并在xhtml上使用它

 public String anystock(int value) {
    String result = null;


    if (value==0)
    {
        result="Please fill the stock of this device";
    }
    else  if (value<5)
    {
        result="The stock will be empty ";
    }

    return result;
}
谢谢你的回答

编辑::


感谢prashant的解决方案

不要将int作为参数,尝试将Integer作为参数…原语int的类解析为int.Class而不是Integer.Class。

类似于“公共字符串anystock(Integer value){”,但仍然是相同的错误消息。请发布该类
            </p:column>
                <p:column headerText="message" >
                    <h:outputText value="#{consumable.anystock(consumable.stock)}"/>
            </p:column>
            <p:column headerText="stock" sortBy="#{consumable.stock}"   filterBy="#{consumable.stock}">
                <h:outputText value="#{consumable.stock}"/>
            </p:column>
javax.servlet.ServletException: Method not found: class entity.Consumable.anystock(java.lang.Integer)