@Override
 public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
   if (object == null) {
     return null;
   }
   if (object instanceof Usuario) {
     Usuario o = (Usuario) object;
     return getStringKey(o.getIdUsuario());
   } else {
     Logger.getLogger(this.getClass().getName())
         .log(
             Level.SEVERE,
             "object {0} is of type {1}; expected type: {2}",
             new Object[] {object, object.getClass().getName(), Usuario.class.getName()});
     return null;
   }
 }
 public void validarRegistro() {
   if (selected.getIdRol().getIdRol().equals(3)) {
     try {
       mensajeRendered = false;
       FacesContext context = FacesContext.getCurrentInstance();
       ServletContext servletContext =
           (ServletContext) context.getCurrentInstance().getExternalContext().getContext();
       context
           .getExternalContext()
           .redirect(servletContext.getContextPath() + "/faces/registro/List.xhtml");
     } catch (IOException ex) {
       Logger.getLogger(HomeManagedBean.class.getName()).log(Level.SEVERE, null, ex);
     }
   } else {
     mensajeRendered = true;
   }
 }