title: JSF, Target unreachable
body: <p>I'm having a problem related to the access to a property of an object. I can't understand what's happening. I have done this tons of times and I have never had this. </p>
  
  <p>My code of the xhtml page is:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML `enter code here`1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:ui="http://xmlns.jcp.org/jsf/facelets"&gt;
      &lt;h:head&gt;
          &lt;title&gt;Facelet Template&lt;/title&gt;
      &lt;/h:head&gt;
      &lt;h:body&gt;
  
         &lt;ui:composition template="./Template.xhtml"&gt;
  
              &lt;ui:define name="top"&gt;                
              &lt;/ui:define&gt;
              &lt;ui:define name="left"&gt;&lt;/ui:define&gt;
              &lt;ui:define name="content"&gt;
               &lt;h:form&gt;
                      &lt;h:panelGrid columns="2" bgcolor="#EBBBBF"&gt;
                          &lt;h:outputText value='#{bMain.getTranslation("username")}'/&gt;&lt;h:inputText value="#{bMain.user.username}"/&gt;
                          &lt;h:outputText value='#{bMain.getTranslation("password")}'/&gt;&lt;h:inputSecret value="#{bMain.user.password}"/&gt;
                          &lt;h:commandButton value='#{bMain.getTranslation("send")}' action="#{bMain.validateUser()}"/&gt;
                      &lt;/h:panelGrid&gt;
               &lt;/h:form&gt;
            &lt;/ui:define&gt;
         &lt;/ui:composition&gt;
      &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here's the code of the BMain class:</p>
  
  <pre><code>public class BMain {
  
      private User user; 
      private final Gestor modelo= new Gestor();
      private ArrayList&lt;String&gt; permisos;
  
  
      public BMain() {
  
          Language language = new Language();
          language.setDescription("EN");
          this.user = new User();
          this.permisos= new ArrayList();
          JSFUtil.setAtributte("language", language);
  
      }    
  
      public String closeSession(){
  
          JSFUtil.logOut();
          return "index";
      }
  
      public String  validateUser(){
  
          String username = user.getUsername();
          String password = user.getPassword();
          this.user = this.modelo.checkUser(username, password);
          try {
              this.permisos = modelo.getPermisos(user);
          } catch (Exception ex) {
              System.out.println("");
          }
  
          if(this.user != null){
  
              JSFUtil.setAtributte("modelo", modelo);
              JSFUtil.setAtributte("user", user);
              JSFUtil.setAtributte("language", user.getLanguage());
              return "inicio";
          } 
  
              return "index";
  
      }
  
      /**
       * @return the usuario
       */
      public User getUser() {
          return user;
      }
  
      public boolean checkPermisos(String permiso){
  
          for(int i=0; i&lt;permisos.size(); i++){
  
              if (permiso.equals(permisos.get(i)))
                return true;
  
          }
  
          return false;
  
      }
  
       public String getTranslation(String name){
  
          String translation = "";
          try {
             translation = this.modelo.getTranslation(name);
          } catch (Exception ex) {
  
          }
  
          return translation;
  
      }
  
  }
  </code></pre>
  
  <p>And the method checkUser from the gestor class:</p>
  
  <pre><code> public User checkUser(String username, String password) {
  
          String sql="from User us where us.username='" + username + "' and us.password='" + password +"'";
  
          ArrayList&lt;User&gt; users;
  
          try {
  
              users= (ArrayList&lt;User&gt;) this.seleccionar(sql);
              if(!users.isEmpty() &amp;&amp; users.size() == 1){
                 User user= users.get(0);
                 return user;
              }
  
          } catch (Exception ex) {
              System.out.println("");
          }
  
  
          return null;
  
      }
  </code></pre>