![](/img/trans.png)
[英]java: cannot access javax.servlet.ServletException class file for javax.servlet.ServletException not found
[英]JSF javax.servlet.ServletException: Method not found: class entity
我想知道如何從我的實體consumable.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;
}
XHTML:
</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)
謝謝你的回答
編輯::
謝謝您的解決方案
與其將int作為參數,不如嘗試將Integer作為參數...原始int的類解析為int.class而不是Integer.class。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.