在f:ajax上使用侦听器找不到属性

时间:2016-06-08 21:28:43

标签: ajax jsf jsf-2

我总是在更新comboBox的值时尝试更改Managed Bean上属性的值。我使用的是JSF 2.0和Tomcat。

我的XHTML页面甚至没有加载,控制台给我带来以下错误:

javax.el.PropertyNotFoundException: Property 'tratarMudancaCreditos' not found on type br.ifsp.eBlueCard.bean.ComprarCreditoBean"

我将把我的Managed Bean方法放在这里,该方法应该改变另一个属性的值。

public void tratarMudancaCreditos(AjaxBehaviorEvent event){

    if(quantidadeCreditos == 30){
        this.valorPagamento = 1.0;
    }else if(quantidadeCreditos == 60){
        this.valorPagamento = 2.0;
    }else if(quantidadeCreditos == 90){
        this.valorPagamento = 3.0;
    }else if(quantidadeCreditos == 120) {
        this.valorPagamento = 4.0;
    }
}

在我的XHTML页面中,我有以下代码:

<h:selectOneMenu id="creditos" value="#{comprarCreditoBean.quantidadeCreditos}" required="true">
                            <f:selectItem itemLabel="" noSelectionOption="true"/>
                            <f:selectItem itemValue="30" itemLabel="30 Créditos" />
                            <f:selectItem itemValue="60" itemLabel="60 Créditos" />
                            <f:selectItem itemValue="90" itemLabel="90 Créditos" />
                            <f:selectItem itemValue="120" itemLabel="120 Créditos" />
                            <f:ajax listener="#{comprarCreditoBean.tratarMudancaCreditos}"/>
                        </h:selectOneMenu>

页面甚至没有加载......

@ EDIT1 我已经看到了这个问题 JSF 2 - Ajax Property not found但我已经在我的代码中使用了解决方案。

@ EDIT2

完整堆栈跟踪:

jun 09, 2016 8:48:24 AM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
GRAVE: Error Rendering View[/compraCredito.xhtml]
javax.el.PropertyNotFoundException: Property 'tratarMudancaCreditos' not found on type br.ifsp.eBlueCard.bean.ComprarCreditoBean


at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:268)
    at javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:221)
    at javax.el.BeanELResolver.property(BeanELResolver.java:355)
    at javax.el.BeanELResolver.getValue(BeanELResolver.java:95)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
    at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
    at com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:214)
    at com.sun.faces.facelets.el.ELText$ELTextComposite.toString(ELText.java:155)
    at com.sun.faces.facelets.compiler.CommentInstruction.write(CommentInstruction.java:77)
    at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:302)


at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:854)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
    at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
    at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:854)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1674)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:854)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1674)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1677)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1677)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:399)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:509)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at br.ifsp.eBlueCard.util.ControleAcesso.doFilter(ControleAcesso.java:56)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)

jun 09, 2016 8:48:24 AM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [Faces Servlet] in context with path [/eBlueCard] threw exception [Property 'tratarMudancaCreditos' not found on type br.ifsp.eBlueCard.bean.ComprarCreditoBean] with root cause
javax.el.PropertyNotFoundException: Property 'tratarMudancaCreditos' not found on type br.ifsp.eBlueCard.bean.ComprarCreditoBean
    at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:268)
    at javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:221)
    at javax.el.BeanELResolver.property(BeanELResolver.java:355)
    at javax.el.BeanELResolver.getValue(BeanELResolver.java:95)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
    at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
    at com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:214)
    at com.sun.faces.facelets.el.ELText$ELTextComposite.toString(ELText.java:155)
    at com.sun.faces.facelets.compiler.CommentInstruction.write(CommentInstruction.java:77)
    at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:302)
    at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:854)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
    at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
    at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:854)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1674)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:854)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1674)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1677)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1677)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:399)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:509)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at br.ifsp.eBlueCard.util.ControleAcesso.doFilter(ControleAcesso.java:56)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)

0 个答案:

没有答案