【发布时间】:2013-03-11 17:29:59
【问题描述】:
我正在使用 JSF 2。
我有一个方法可以检查值列表中的匹配值:
@ManagedBean(name="webUtilMB")
@ApplicationScoped
public class WebUtilManagedBean implements Serializable{ ...
public static boolean isValueIn(Integer value, Integer ... options){
if(value != null){
for(Integer option: options){
if(option.equals(value)){
return true;
}
}
}
return false;
}
...
}
我尝试在 EL 中调用此方法:
#{webUtilMB.isValueIn(OtherBean.category.id, 2,3,5)}
但它给了我一个:
严重 [javax.enterprise.resource.webcontainer.jsf.context] (http-localhost/127.0.0.1:8080-5) java.lang.IllegalArgumentException: 参数数量错误
有没有办法从 EL 执行这样的方法?
【问题讨论】: