我有一个HIBERNATE DAOImpl,它使用以下方法,传递一个变量作为参数。
public List<Oportunidad> verParticipantes(String numeroOportunidad) throws DAOException {
List<Oportunidad> lista = getHibernateTemplate().find("SELECT c.cliente FROM Oportunidad o ,OportunidadParticipante op,"
+ "Cliente c WHERE op.oportunidad=o.id and c.idCliente=op.cliente and o.numeroOportunidad=?",numeroOportunidad);
return lista;
}
和ServiceImpl
public List<Oportunidad> verParticipantes(String numeroOportunidad)throws DAOException {
return getOportunidadDao().verParticipantes(numeroOportunidad);
}
这两个接口都使用。这些代码可以通过junit进行测试来编译和运行。Goog,非常好
问题是,当我想从selectOneListboxt传递参数时,它实现了一个JSF primefaces
代码ManagedBean:
public String getVerParticipantes(String numeroOportunidad) throws DAOException{
Oportunidad o = new Oportunidad();
o.setNumeroOportunidad(numeroOportunidad);
verParticipantes.addAll(getOportunidadService().verParticipantes(numeroOportunidad));
return "envioCotizacion.xhtml";
}
JSF代码(. xhtml):
<p:selectOneListbox id="listaCliente" value="#{clienteMB.cliente}" style="width:26%; height:90%; position:absolute; top:10%; left:12%;">
<f:selectItems value='#{oportunidadMB.verParticipantes("prueba")}'/>
<!-- <f:param name="numeroOportunidad" value="prueba" />-->
<p:ajax id="numeroOportunidad" listener='#{oportunidadMB.verParticipantes("prueba")}'></p:ajax>
</p:selectOneListbox>
错误屏幕:::::::::
javax.el.MethodNotFoundException: Unable to find method [verParticipantes] with [1] parameters
at javax.el.BeanELResolver.invoke(BeanELResolver.java:444)
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:161)
at org.apache.el.parser.AstValue.getValue(AstValue.java:173)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UISelectItems.getValue(UISelectItems.java:129)
at org.primefaces.renderkit.InputRenderer.getSelectItems(InputRenderer.java:55)
at org.primefaces.component.selectonelistbox.SelectOneListboxRenderer.encodeMarkup(SelectOneListboxRenderer.java:49)
at org.primefaces.component.selectonelistbox.SelectOneListboxRenderer.encodeEnd(SelectOneListboxRenderer.java:42)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:70)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:57)
at org.primefaces.component.layout.LayoutUnitRenderer.encodeEnd(LayoutUnitRenderer.java:51)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
帮助我plis...不再做这个错误。
3条答案
按热度按时间wlwcrazw1#
应该是
但是getVerParticipantes也应该返回一个列表而不是字符串!
在服务中声明,但是manage oportunidadMB只有getVerParticipantes方法,该方法返回String而不是list,因此如何调用
jyztefdp2#
检查bean名称“oportunidadMB”与变量名称jsf/camunda/etc context是否不同。
jum4pzuy3#
将方法名称
getVerParticipantes
更改为verParticipantes
。侦听器方法不需要是getter。你也不能把监听器作为一个动作,所以它应该是void的返回类型。