1

I'm trying to change the value of an attribute on my Managed Bean always when the value of my comboBox is updated. I'm using JSF 2.0 and Tomcat.

My XHTML page is not even loaded and the console brings me the following error:

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

I'll put here my Managed Bean method that should change the value from the another attribute.

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;
    }
}

In my XHTML page I have the following code:

<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>

The page is not even loading...

@Edit1 I've alreay saw this question JSF 2 - Ajax Property not found but I'm already using the solution in my code.

@Edit2

The full stack trace:

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)
Community
  • 1
  • 1
  • post an [mcve]. I think that the error you get is not from the xhtml you posted (but I'm tired and just home from an Iron Maiden concert, so I might have missed something) – Kukeltje Jun 09 '16 at 00:08
  • Try to use `public void tratarMudancaCreditos(SelectEvent event) {` – Holger Jun 09 '16 at 06:34
  • There are at least two possible causes for this. The answer is as usual in the stack trace. But this information is missing in the question. – BalusC Jun 09 '16 at 07:47
  • The cause is crystal clear in stack trace. This question has been asked and answered before. See the abovelinked duplciate. In your future questions, always include full stack trace in order to get answers sooner as the stack trace itself basically represents the whole answer at its own. – BalusC Jun 09 '16 at 12:02
  • I'm sorry, I'm a new member here, as well new programmer in JSF and ajax. I had a commented line but I removed. Now the page loads but changing the comboBox value is not working. The method is not being invoked on my Managed Bean. I'll look for an answer. Thanks for your help. – Victor Senna Jun 09 '16 at 12:10

0 Answers0