Problem with JSF, Spring and Hibernate driver

0

I am developing with JSF, Spring and hibernate and I can not create a Controller with my own methods to be able to call them from the xhtml, this is my code

HomeController.java

@ManagedBean
public class HomeController implements Serializable{

    private static final Logger log = LoggerFactory.getLogger(HomeController.class);
    private static final long serialVersionUID = 1L;
    private String descripcion;
    public HomeController() {
        this.descripcion = "OK";
    }
    public String getDescripcion() {
        return this.descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }
    public void UserLog(){
        log.info("somethings");
    }
}

home.xhtml

<h:commandButton value="#{HomeController.descripcion}" action="#    {HomeController.UserLog()}"/>

But it does not work.

    
asked by yop 26.01.2017 в 21:26
source

1 answer

0

Unless explicitly specified, the names assigned to the managed beans in the scope are the name of the class starting in lowercase. Thus, your HomeController bean would be accessible through homeController, and your code would be:

<h:commandButton value="#{homeController.descripcion}" action="#{homeController.UserLog()}"/>
    
answered by 26.01.2017 в 22:07