当前位置: 代码迷 >> Java Web开发 >> JSF中javax.faces.el.PropertyNotFoundException: Error getting property的有关问题
  详细解决方案

JSF中javax.faces.el.PropertyNotFoundException: Error getting property的有关问题

热度:2200   发布时间:2013-02-25 21:14:55.0
JSF中javax.faces.el.PropertyNotFoundException: Error getting property的问题
先贴一下代码吧。jsp页面中代码如下:
Java code
<h:outputText value="掌握外语语种:" /><h:selectManyListbox value="#{ResumeBean.language}">     <f:selectItems value="#{ResumeBean.languageMap}" /></h:selectManyListbox>

这里是想使用托管的bean给前台注入值。后台的java代码如下:
Java code
private static Map<String, String> languageMap = null;    public static Map<String, String> getLanguageMap() {        languageMap = new LinkedHashMap<String, String>();        languageMap.put("英语", "英语");        languageMap.put("日语", "日语");        languageMap.put("俄语", "俄语");        languageMap.put("德语", "德语");        return languageMap;    }    public static void setLanguageMap(Map<String, String> languageMap) {        ResumeBean.languageMap = languageMap;    }

但是在运行jsf页面的时候,总是报错,检查了很久,不知道什么原因。错误代码如下:
Java code
严重: Servlet.service() for servlet jsp threw exceptionjavax.faces.el.PropertyNotFoundException: Error getting property 'languageMap' from bean of type cn.test.ResumeBean    at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:107)    at com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)    at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)    at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)    at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)    at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)    at javax.faces.component.UISelectItems.getValue(UISelectItems.java:110)    at com.sun.faces.util.Util.getSelectItems(Util.java:614)    at com.sun.faces.renderkit_basic.MenuRenderer.getOptionNumber(MenuRenderer.java:488)    at com.sun.faces.renderkit_basic.MenuRenderer.renderSelect(MenuRenderer.java:465)    at com.sun.faces.renderkit_basic.MenuRenderer.encodeEnd(MenuRenderer.java:430)    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:712)    at com.sun.faces.renderkit_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:443)    at com.sun.faces.renderkit_basic.GridRenderer.encodeChildren(GridRenderer.java:233)    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:693)    at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:600)    at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:537)    at com.sun.faces.taglib_basic.PanelGridTag.doEndTag(PanelGridTag.java:460)    at org.apache.jsp.pages.resume_jsp._jspx_meth_h_005fpanelGrid_005f0(resume_jsp.java:261)    at org.apache.jsp.pages.resume_jsp._jspx_meth_h_005fform_005f0(resume_jsp.java:180)    at org.apache.jsp.pages.resume_jsp._jspx_meth_f_005fview_005f0(resume_jsp.java:143)    at org.apache.jsp.pages.resume_jsp._jspService(resume_jsp.java:108)    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:659)    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:457)    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395)    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311)    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
  相关解决方案