java ee - jsf 2.0 property not found -
i looking problem since 2 days , can´t solve it! jsf managed bean looks that:
@named(value = "hardwarerevisioncreatecontroller") @requestscoped public class hardwarerevisioncreatecontroller { private hardware.type type; public hardwarerevisioncreatecontroller() { } public hardware.type gettype() { return type; } public void settype(hardware.type type) { this.type = type; } public list<hardware.type> gethardwaretypes() { list<hardware.type> list = new arraylist<>(); list.addall(arrays.aslist(hardware.type.values())); return list; } }
and want access variable hardwaretypes jsf page:
<h:selectonemenu value="#{hardwarerevisioncreatecontroller.type}"> <f:selectitems value="#{hardwarerevisioncreatecontroller.hardwaretypes}" var="type" itemvalue="#{type}" itemlabel="#{type.name()}" /> </h:selectonemenu>
and following error:
warning: standardwrappervalve[faces servlet]: servlet.service() servlet faces servlet threw exception javax.el.propertynotfoundexception: class 'com.thomasperoutka.alptiming.controller.hardwarerevisioncreatecontroller' not have property 'hardwaretypes'. @ javax.el.beanelresolver.getbeanproperty(beanelresolver.java:731) @ javax.el.beanelresolver.getvalue(beanelresolver.java:351) @ com.sun.faces.el.demuxcompositeelresolver._getvalue(demuxcompositeelresolver.java:176) @ com.sun.faces.el.demuxcompositeelresolver.getvalue(demuxcompositeelresolver.java:203) @ com.sun.el.parser.astvalue.getvalue(astvalue.java:140) @ com.sun.el.parser.astvalue.getvalue(astvalue.java:204) @ com.sun.el.valueexpressionimpl.getvalue(valueexpressionimpl.java:226) @ org.jboss.weld.el.weldvalueexpression.getvalue(weldvalueexpression.java:50) @ com.sun.faces.facelets.el.tagvalueexpression.getvalue(tagvalueexpression.java:109) @ javax.faces.component.componentstatehelper.eval(componentstatehelper.java:194) @ javax.faces.component.componentstatehelper.eval(componentstatehelper.java:182) @ javax.faces.component.uiselectitems.getvalue(uiselectitems.java:129) @ com.sun.faces.renderkit.selectitemsiterator.initializeitems(selectitemsiterator.java:208) @ com.sun.faces.renderkit.selectitemsiterator.hasnext(selectitemsiterator.java:135) @ com.sun.faces.renderkit.html_basic.menurenderer.renderoptions(menurenderer.java:762) @ com.sun.faces.renderkit.html_basic.menurenderer.renderselect(menurenderer.java:847) @ com.sun.faces.renderkit.html_basic.menurenderer.encodeend(menurenderer.java:297) @ javax.faces.component.uicomponentbase.encodeend(uicomponentbase.java:919) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1863) @ javax.faces.render.renderer.encodechildren(renderer.java:176) @ javax.faces.component.uicomponentbase.encodechildren(uicomponentbase.java:889) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1856) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1859) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1859) @ com.sun.faces.application.view.faceletviewhandlingstrategy.renderview(faceletviewhandlingstrategy.java:456) @ com.sun.faces.application.view.multiviewhandler.renderview(multiviewhandler.java:133) @ javax.faces.application.viewhandlerwrapper.renderview(viewhandlerwrapper.java:337) @ javax.faces.application.viewhandlerwrapper.renderview(viewhandlerwrapper.java:337) @ com.sun.faces.lifecycle.renderresponsephase.execute(renderresponsephase.java:120) @ com.sun.faces.lifecycle.phase.dophase(phase.java:101) @ com.sun.faces.lifecycle.lifecycleimpl.render(lifecycleimpl.java:219) @ javax.faces.webapp.facesservlet.service(facesservlet.java:647) @ org.apache.catalina.core.standardwrapper.service(standardwrapper.java:1682) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:318) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:160) @ org.apache.catalina.core.standardpipeline.doinvoke(standardpipeline.java:734) @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:673) @ com.sun.enterprise.web.webpipeline.invoke(webpipeline.java:99) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:174) @ org.apache.catalina.connector.coyoteadapter.doservice(coyoteadapter.java:415) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:282) @ com.sun.enterprise.v3.services.impl.containermapper$httphandlercallable.call(containermapper.java:459) @ com.sun.enterprise.v3.services.impl.containermapper.service(containermapper.java:167) @ org.glassfish.grizzly.http.server.httphandler.runservice(httphandler.java:201) @ org.glassfish.grizzly.http.server.httphandler.dohandle(httphandler.java:175) @ org.glassfish.grizzly.http.server.httpserverfilter.handleread(httpserverfilter.java:235) @ org.glassfish.grizzly.filterchain.executorresolver$9.execute(executorresolver.java:119) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executefilter(defaultfilterchain.java:284) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executechainpart(defaultfilterchain.java:201) @ org.glassfish.grizzly.filterchain.defaultfilterchain.execute(defaultfilterchain.java:133) @ org.glassfish.grizzly.filterchain.defaultfilterchain.process(defaultfilterchain.java:112) @ org.glassfish.grizzly.processorexecutor.execute(processorexecutor.java:77) @ org.glassfish.grizzly.nio.transport.tcpniotransport.fireioevent(tcpniotransport.java:561) @ org.glassfish.grizzly.strategies.abstractiostrategy.fireioevent(abstractiostrategy.java:112) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.run0(workerthreadiostrategy.java:117) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.access$100(workerthreadiostrategy.java:56) @ org.glassfish.grizzly.strategies.workerthreadiostrategy$workerthreadrunnable.run(workerthreadiostrategy.java:137) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.dowork(abstractthreadpool.java:565) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.run(abstractthreadpool.java:545) @ java.lang.thread.run(thread.java:744)
anyone idea of problem?
as recall have declare variable name, getter isn't enough. try adding private list<hardware.type> hardwaretypes;
bean. , change getter to
public list<hardware.type> gethardwaretypes() { if (this.hardwaretypes == null) { hardwaretypes = new arraylist<hardware.type>(); hardwaretypes.addall(arrays.aslist(hardware.type.values())); } return this.hardwaretypes; }
or (never tried this) try changing value value="#{hardwarerevisioncreatecontroller.gethardwaretypes()}"
Comments
Post a Comment