java - Can't access managed bean again... jsf -


i'm not sure doing wrong. had same problem project of mine not access managed beans.

here facelet client:

<?xml version='1.0' encoding='utf-8' ?> <!doctype composition public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"             xmlns:h="http://xmlns.jcp.org/jsf/html"             xmlns:p="http://xmlns.jcp.org/jsf/passthrough"             xmlns:c="http://java.sun.com/jsp/jstl/core"             xmlns="http://www.w3.org/1999/xhtml"             template="./template.xhtml"             xmlns:f="http://xmlns.jcp.org/jsf/core">  <ui:define name="left">     <h:form>         <h:inputtextarea value="#{blogmanager.blogentity.text}" p:placeholder="tweet max 30 chars." style="width: 100%; height:150px; resize: none;" /><br/><br/>         <h:commandbutton value="tweet" action="#{blogmanager.save}" />     </h:form> </ui:define>  <ui:define name="right">     <c:foreach items="#{blogmanager.blogs()}" var="item">         <h:outputtext value="#{blogmanager.item.text}" />&nbsp;&nbsp;         likes: &nbsp;&nbsp;<h:outputtext value="" />&nbsp;&nbsp;&nbsp;         <h:commandlink action="" value="like">             <f:param name="tweetid" value="" />             <f:param name="username" value="" />         </h:commandlink>&nbsp;<br />         <textarea>             <h:outputtext value="" />         </textarea>     </c:foreach> </ui:define> 

this managed bean:

@named("blogmanager") @sessionscoped public class blogmanager implements serializable { private blog blogentity;  @ejb private blogfacade blogfacade;  @postconstruct public void init(){     blogentity = new blog(); }  public blog getblogentity(){     return this.blogentity; }  public void setblogentity(blog blogentity){     this.blogentity = blogentity; }  public void save(){     blogfacade.create(blogentity); }  public void delete(){     blogfacade.remove(blogentity); }  public void deleteblog(@queryparam("blogid") int id){     blogfacade.deleteblog(id); }  public list<blog> getblogs(){     return blogfacade.getblogs(); } } 

when trying use commandbutton "tweet" message: /index.xhtml @13,156 value="#{blogmanager.blogentity.text}": target unreachable, identifier 'blogmanager' resolved null

what doing wrong? ide netbeans recognizes managedbean in facelet , suggests message bean specific methods , entities.

stack trace:

javax.el.propertynotfoundexception: /index.xhtml @13,156 value="#{blogmanager.blogentity.text}": target unreachable, identifier 'blogmanager' resolved null @ com.sun.faces.facelets.el.tagvalueexpression.gettype(tagvalueexpression.java:100) @ com.sun.faces.renderkit.html_basic.htmlbasicinputrenderer.getconvertedvalue(htmlbasicinputrenderer.java:95) @ javax.faces.component.uiinput.getconvertedvalue(uiinput.java:1046) @ javax.faces.component.uiinput.validate(uiinput.java:976) @ javax.faces.component.uiinput.executevalidate(uiinput.java:1249) @ javax.faces.component.uiinput.processvalidators(uiinput.java:712) @ javax.faces.component.uiform.processvalidators(uiform.java:253) @ javax.faces.component.uicomponentbase.processvalidators(uicomponentbase.java:1261) @ javax.faces.component.uicomponentbase.processvalidators(uicomponentbase.java:1261) @ javax.faces.component.uiviewroot.processvalidators(uiviewroot.java:1195) @ com.sun.faces.lifecycle.processvalidationsphase.execute(processvalidationsphase.java:76) @ com.sun.faces.lifecycle.phase.dophase(phase.java:101) @ com.sun.faces.lifecycle.lifecycleimpl.execute(lifecycleimpl.java:198) @ javax.faces.webapp.facesservlet.service(facesservlet.java:646) @ 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:357) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:260) @ com.sun.enterprise.v3.services.impl.containermapper.service(containermapper.java:188) @ org.glassfish.grizzly.http.server.httphandler.runservice(httphandler.java:191) @ org.glassfish.grizzly.http.server.httphandler.dohandle(httphandler.java:168) @ org.glassfish.grizzly.http.server.httpserverfilter.handleread(httpserverfilter.java:189) @ org.glassfish.grizzly.filterchain.executorresolver$9.execute(executorresolver.java:119) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executefilter(defaultfilterchain.java:288) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executechainpart(defaultfilterchain.java:206) @ org.glassfish.grizzly.filterchain.defaultfilterchain.execute(defaultfilterchain.java:136) @ org.glassfish.grizzly.filterchain.defaultfilterchain.process(defaultfilterchain.java:114) @ org.glassfish.grizzly.processorexecutor.execute(processorexecutor.java:77) @ org.glassfish.grizzly.nio.transport.tcpniotransport.fireioevent(tcpniotransport.java:838) @ org.glassfish.grizzly.strategies.abstractiostrategy.fireioevent(abstractiostrategy.java:113) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.run0(workerthreadiostrategy.java:115) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.access$100(workerthreadiostrategy.java:55) @ org.glassfish.grizzly.strategies.workerthreadiostrategy$workerthreadrunnable.run(workerthreadiostrategy.java:135) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.dowork(abstractthreadpool.java:564) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.run(abstractthreadpool.java:544) @ java.lang.thread.run(thread.java:744)       caused by: javax.el.propertynotfoundexception: target unreachable, identifier 'blogmanager' resolved null @ com.sun.el.parser.astvalue.gettarget(astvalue.java:174) @ com.sun.el.parser.astvalue.gettype(astvalue.java:86) @ com.sun.el.valueexpressionimpl.gettype(valueexpressionimpl.java:201) @ org.jboss.weld.el.weldvalueexpression.gettype(weldvalueexpression.java:93) @ com.sun.faces.facelets.el.tagvalueexpression.gettype(tagvalueexpression.java:98) 

<h:outputtext value="#{blogmanager.item.text}" 

should

<h:outputtext value="#{item.text}" 

you should initialize new entity in bean's constructor, if doesn't need initialization value service.

edit : try changing

@named("blogmanager") 

to @named("blogmanager")

and in facelet, replace

<h:inputtextarea value="#{blogmanager.blogentity.text}"  

by

<h:inputtextarea value="#{blogmanager.blogentity.text}" > 

in java programming language, convention / standard way name objects use lower case letter first letter. i.e change blogentity blogentity. problem not related that, still it's thing stick standards.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -