3 Replies Latest reply: Mar 14, 2012 11:49 AM by Maheswara Sunkara RSS

EL Exception, property not found exception in runtime

wingman zx Newbie

Hi i am getting property not found exception thought i have  autocomplete method in my bean

 

public List<String> autocomplete(String prefix) {

        ArrayList<String> result = new ArrayList<String>();

        if ((prefix == null) || (prefix.length() == 0)) {

            for (int i = 0; i < 10; i++) {

                result.add(capitals.get(i).getState());

            }

 

 

        } else {

            Iterator<Capital> iterator = capitals.iterator();

            while (iterator.hasNext()) {

                Capital elem = ((Capital) iterator.next());

                if ((elem.getState() != null && elem.getState().toLowerCase().indexOf(prefix.toLowerCase()) == 0)

                    || "".equals(prefix)) {

                    result.add(elem.getState());

                }

            }

        }

 

 

        return result;

    }

 

 

 

 

 

Below is the stack trace

 

 

 

SEVERE: Error Rendering View[/qunit/autocomplete-qunit.xhtml]

javax.el.ELException: /qunit/autocomplete-qunit.xhtml: Property 'autocomplete' not found on type org.richfaces.demo.autocomplete.AutoCompleteBean

          at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:94)

          at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)

          at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)

          at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)

          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1756)

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)

          at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)

          at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)

          at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)

          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:594)

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

          at java.lang.Thread.run(Thread.java:662)

  • 1. Re: EL Exception, property not found exception in runtime
    Maheswara Sunkara Novice

    provide xhtml as well..

  • 2. Re: EL Exception, property not found exception in runtime
    wingman zx Newbie

    Here is my xhtml

     

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml"

              xmlns:h="http://java.sun.com/jsf/html"

              xmlns:f="http://java.sun.com/jsf/core"

              xmlns:ui="http://java.sun.com/jsf/facelets"

              xmlns:input="http://richfaces.org/input"

              xmlns:a4j="http://richfaces.org/a4j">

     

     

    <f:view contentType="text/html" />

     

     

    <h:head>

              <title>Richfaces Autocomplete</title>

    </h:head>

     

     

    <h:body style="margin: 30px;">

     

     

    <ui:composition template="/templates/template.xhtml">

     

     

        <ui:define name="scripts">

            <h:outputScript name="qunit/qunit.js" />

            <h:outputScript name="qunit/richfaces-qunit.js" />

     

     

            <h:outputStylesheet name="qunit/qunit.css" />

        </ui:define>

     

     

        <ui:define name="title">Autocomplete qunit tests</ui:define>

        <ui:define name="body_head">Autocomplete qunit tests</ui:define>

     

     

        <ui:define name="body">

            <p>Page</p>

     

     

            <h:form id="form">

                                  <input:autocomplete id="autocompleteDefault" value="a" fetchValue="#{country.name}" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country"

                                  onchange="return onEvent.call(this, event);" onselectitem="return onEvent.call(this, event);" onblur="return onEvent.call(this, event);" onfocus="return onEvent.call(this, event);">

                                  #{country.name} #{country.iso} #{country.domain}

                                  </input:autocomplete><br />

                                  <input:autocomplete id="autocompleteDefault2" fetchValue="#{country.name}" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country"

                                  onselectitem="return onEvent.call(this, event);" showButton="true" mode="client">

                                  #{country.name} #{country.iso} #{country.domain}

                                  </input:autocomplete><br />

                                  <input:autocomplete id="autocompleteClientMode" mode="client" fetchValue="#{country.name}" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" showButton="true">

                                  #{country.name} #{country.iso} #{country.domain}

                                  </input:autocomplete><br />

                                  <input:autocomplete id="autocompleteLazyClientMode" mode="lazyClient" fetchValue="#{country.name}" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" showButton="true">

                                  #{country.name} #{country.iso} #{country.domain}

                                  </input:autocomplete><br />

                                  <input:autocomplete id="autocompleteAjaxMode" mode="ajax" fetchValue="#{country.name}" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" showButton="true">

                                  #{country.name} #{country.iso} #{country.domain}

                                  </input:autocomplete><br />

                                  <input:autocomplete id="autocompleteCachedAjaxMode" mode="cachedAjax" fetchValue="#{country.name}" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" showButton="true">

                                  #{country.name} #{country.iso} #{country.domain}

                                  </input:autocomplete>

            </h:form>

     

     

            <p>Result</p>

            <div>

                <ol id="qunit-tests"></ol>

            </div>

            <h:outputScript name="tests/autocomplete-qunit.js" />

        </ui:define>

    </ui:composition>

    </h:body>

    </html>

     

     

     

     

    and the bean class

     

     

     

     

    package org.richfaces.demo.autocomplete;

     

     

    import java.util.ArrayList;

    import java.util.Iterator;

    import java.util.List;

     

     

    import javax.annotation.PostConstruct;

    import javax.faces.bean.ManagedBean;

    import javax.faces.bean.ManagedProperty;

    import javax.faces.bean.RequestScoped;

     

     

    import org.richfaces.demo.tables.model.capitals.Capital;

     

     

    @ManagedBean

    @RequestScoped

    public class AutocompleteBean {

        private String value;

        private List<String> autocompleteList;

        @ManagedProperty(value = "#{capitalsParser.capitalsList}")

        private List<Capital> capitals;

     

     

        public AutocompleteBean() {

            // TODO Auto-generated constructor stub

        }

     

     

        @PostConstruct

        public void init() {

            autocompleteList = new ArrayList<String>();

            for (Capital cap : capitals) {

                autocompleteList.add(cap.getState());

            }

        }

     

     

        public List<String> autocomplete(String prefix) {

            ArrayList<String> result = new ArrayList<String>();

            if ((prefix == null) || (prefix.length() == 0)) {

                for (int i = 0; i < 10; i++) {

                    result.add(capitals.get(i).getState());

                }

     

     

            } else {

                Iterator<Capital> iterator = capitals.iterator();

                while (iterator.hasNext()) {

                    Capital elem = ((Capital) iterator.next());

                    if ((elem.getState() != null && elem.getState().toLowerCase().indexOf(prefix.toLowerCase()) == 0)

                        || "".equals(prefix)) {

                        result.add(elem.getState());

                    }

                }

            }

     

     

            return result;

        }

     

     

        public String getValue() {

            return value;

        }

     

     

        public void setValue(String value) {

            this.value = value;

        }

     

     

        public List<String> getAutocompleteList() {

            return autocompleteList;

        }

     

     

        public void setAutocompleteList(List<String> autocompleteList) {

            this.autocompleteList = autocompleteList;

        }

     

     

        public void setCapitals(List<Capital> capitals) {

            this.capitals = capitals;

        }

    }

  • 3. Re: EL Exception, property not found exception in runtime
    Maheswara Sunkara Novice

    looks like bean class name is not correct

     

    you declared it as 'public class AutocompleteBean'

     

    it should be ( 'C' capital)

     

    public class AutoCompleteBean