title: Target Unreachable, identifier "Bean Name" resolved to null
body: <p>I m getting below error. I m new to JSF.</p>
  
  <pre><code>Jul 21, 2013 6:24:04 PM com.sun.faces.lifecycle.ProcessValidationsPhase execute
  WARNING: /index.xhtml @18,65 value="#{userbean.userName}": Target Unreachable, identifier 'userbean' resolved to null
  javax.el.PropertyNotFoundException: /index.xhtml @18,65 value="#{userbean.userName}": Target Unreachable, identifier 'userbean' resolved to null
      at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)
      at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
      at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1030)
      at javax.faces.component.UIInput.validate(UIInput.java:960)
      at javax.faces.component.UIInput.executeValidate(UIInput.java:1233)
      at javax.faces.component.UIInput.processValidators(UIInput.java:698)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
      at javax.faces.component.UIForm.processValidators(UIForm.java:253)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
      at org.primefaces.component.panel.Panel.processValidators(Panel.java:284)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
      at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1172)
      at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>package com.jsf.dev.bean;
  
  import java.io.Serializable;
  
  import javax.faces.bean.ManagedBean;
  
  @ManagedBean(name = "userbean")
  public class UserBean implements Serializable {
  
      private static final long serialVersionUID = 1L;
      private String userName;
      private String userPassword;
  
      public String getUserName() {
          return userName;
      }
  
      public void setUserName(String userName) {
          this.userName = userName;
      }
  
      public String getUserPassword() {
          return userPassword;
      }
  
      public void setUserPassword(String userPassword) {
          this.userPassword = userPassword;
      }
  
      public String login(){
          return "login";
      }
  }
  </code></pre>
  
  <p>XHTML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3c.org/1999/xhtml"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui"&gt;
  
  &lt;h:head&gt;
  
  &lt;/h:head&gt;
  &lt;h:body&gt;
      &lt;center&gt;
          &lt;p:panel header="Login Form" style="width:350;"&gt;
              &lt;h:form&gt;
                  &lt;h:panelGrid columns="2" cellpadding="2"&gt;
                      &lt;h:outputLabel for="#{userbean.userName}" value="UserName" /&gt;
                      &lt;h:inputText value="#{userbean.userName}" label="UserName"&gt;&lt;/h:inputText&gt;
                      &lt;h:outputLabel for="#{userbean.userPassword}" value="Password" /&gt;
                      &lt;h:inputSecret value="#{userbean.userPassword}"&gt;&lt;/h:inputSecret&gt;
                      &lt;h:commandButton type="submit" value="Login"
                          action="#{userbean.login}"&gt;&lt;/h:commandButton&gt;
                  &lt;/h:panelGrid&gt;
              &lt;/h:form&gt;
          &lt;/p:panel&gt;
          &lt;div&gt;
              &lt;h:messages&gt;&lt;/h:messages&gt;
          &lt;/div&gt;
      &lt;/center&gt;
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>