JSF @Named Target Unreachable, identifier '*bean*' resolved to null -
this question has answer here:
i checked there many other threads similar issues cannot find what's wrong one. cdi @named doesn't conflict @managedbean. bean class i'm using.
@named @requestscoped public class userbean { private string name; public userbean() { } public string getname() { return name; } public void setname(string name) { this.name = name; } public string addvaluestoflashaction() { flash flash = facescontext.getcurrentinstance() .getexternalcontext().getflash(); flash.put("name", name); return "terms?faces-redirect=true"; } public void pullvaluesfromflashaction(componentsystemevent e) { flash flash = facescontext.getcurrentinstance() .getexternalcontext().getflash(); this.name = (string) flash.get(name); } ... }
and body of xhtml index page
<h:body> <f:metadata> <f:event type="prerenderview" listener="#{userbean.pullvaluesfromflashaction}"/> </f:metadata> <h:messages/> <h:form> name: <h:inputtext value="#{userbean.name}"/> <h:commandbutton value="register" action="#{userbean.addvaluestoflashaction()}"/> </h:form> </h:body>
when run have /flashindex.xhtml @12,72 listener="#{userbean.pullvaluesfromflashaction}": target unreachable, identifier 'userbean' resolved null , in glassfish logs throws javax.el.propertynotfoundexception
solved: imported javax.faces.bean.requestscoped instead of javax.enterprise.context.requestscoped
Comments
Post a Comment