el - Target Unreachable, identifier resolved to null JSF 2.2 -
i looked those:
target unreachable, identifier resolved null in jsf 2.2
"target unreachable, identifier 'authenticator' resolved null" in seam
java ee 6: target unreachable, identifier 'hellobean' resolved null
target unreachable, identifier "bean name" resolved null
target unreachable, identifier "bean name" resolved null
jsf: /index.xhtml @12,80 value="#{loginbean.username}": target unreachable, identifier 'loginbean' resolved null
http://www.coderanch.com/t/598907/jsf/java/target-unreachable-identifier-resolved-null
but none of them worked me.
login.xhtml:
<?xml version="1.0" encoding="utf-8" ?> <!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"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>login page</title> </head> <body> <h:form prependid="false"> <h3>wellcome</h3> <br /> <h3>enter</h3> <table> <tr> <td><h3>name</h3></td> <td><h:inputtext value="#{user.name}" id="name" /></td> </tr> <tr> <td><h3>password</h3></td> <td><h:inputsecret value="#{user.password}" id="password" /></td> </tr> </table> <h:commandbutton value="login"> <f:ajax execute="name password" render="out" /> </h:commandbutton> <h3> <h:outputtext id="out" value="#{user.greeting}" /> </h3> </h:form> </body> </html>
user.java:
import java.io.serializable; import javax.annotation.managedbean; import javax.faces.bean.sessionscoped; @managedbean @sessionscoped public class user implements serializable { private string name; private string password; private string greeting; public string getgreeting() { if (name.length() == 0) homecoming ""; else homecoming "welcome jsf2 + ajax, " + name + "!"; } public string getname() { homecoming name; } public void setname(string name) { this.name = name; } public string getpassword() { homecoming password; } public void setpassword(string password) { this.password = password; } public void setgreeting(string greeting) { this.greeting = greeting; } }
i did not config web.xml, because jsf2.2 know.
class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <display-name>ajax</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <context-param> <description>state saving method: 'client' or 'server' (=default). see jsf specification 2.5.2</description> <param-name>javax.faces.state_saving_method</param-name> <param-value>client</param-value> </context-param> <context-param> <param-name>javax.servlet.jsp.jstl.fmt.localizationcontext</param-name> <param-value>resources.application</param-value> </context-param> <listener> <listener-class>com.sun.faces.config.configurelistener</listener-class> </listener> </web-app>
config face:
<?xml version="1.0" encoding="utf-8"?> <faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd" version="2.2"> </faces-config>
error when click button:
http status 500 - /login.xhtml @17,78 value="#{user.name}": target unreachable, identifier 'user' resolved null -------------------------------------------------------------------------------- type exception study message /login.xhtml @17,78 value="#{user.name}": target unreachable, identifier 'user' resolved null description server encountered internal error prevented fulfilling request. exception javax.el.propertynotfoundexception: target unreachable, identifier 'user' resolved null @ org.apache.el.parser.astvalue.gettarget(astvalue.java:98) @ org.apache.el.parser.astvalue.gettype(astvalue.java:82) @ org.apache.el.valueexpressionimpl.gettype(valueexpressionimpl.java:172) @ com.sun.faces.facelets.el.tagvalueexpression.gettype(tagvalueexpression.java:98) @ 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.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.applicationfilterchain.internaldofilter(applicationfilterchain.java:305) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210) @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:51) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:243) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:222) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:123) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:502) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:171) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:100) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:953) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:118) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1041) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:603) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:312) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ java.lang.thread.run(unknown source)
and warning:
typee value of field user.greeting not used
but there 2 strings same , set no warnings them.
i utilize tomcat 7.0.54.
there's quite bit wrong current code:
you're using wrong jsf annotations
you're not using jsf-standard tags. use:
<h:head/>
instead of <head>
(this required ajax functionality in jsf. without it, necessary javascript back upwards ajax cannot included on page <h:body>
instead of <body>
an http-500 indicative of actual bug in code.
jsf el propertynotfoundexception
No comments:
Post a Comment