commandLink does not create a link on the screen

0

I'm starting with sf and I'm having a problem with this project.

The following command does not create the link on the screen that I need to go to the next page, just give me "New user" written on the screen:

<?xml version="1.0" encoding="UTF-8"?>
    <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Financeiro</title>
    </h:head>
    <h:body>
        <h1>Financeiro</h1>
        <h:form>
            <h:commandLink action="#{usuarioBean.novo}">Novo Usuário</h:commandLink>    
        </h:form>
    </h:body>
    </html>

I also tried this variation, without success:

<h:commandLink action="#{usuarioBean.novo}" value="Novo usuário"/>

The method called by #{usuarioBean.novo}

public class UsuarioBean {
    private Usuario usuario = new Usuario();
    private String confirmarSenha;

    public String novo() { 
        this.usuario = new Usuario();
        this.usuario.setAtivo(true);
        return "/publico/usuario"; 
    }
}

Can anyone identify where the error is?

    
asked by anonymous 23.06.2016 / 14:36

1 answer

0

So what I saw missing was redirect

public class UsuarioBean {
private Usuario usuario = new Usuario();
private String confirmarSenha;

    public String novo() { 
        this.usuario = new Usuario();
        this.usuario.setAtivo(true);
        return "/publico/usuario.xhtml?faces-redirect=true"; 
    }
}
    
24.06.2016 / 01:26