Search code examples
jsflabelcommandlink

commandLink don't put a link on screen


i'm starting with jsf and i'm having a issue with this project.

The following command don't create a link that i need to go to the next page, only give me "Novo usuário" 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"/>

This is 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"; 
    }
}

P.S. i'm br, so i'm sorry in advance for my english


Solution

  • You're going to want to use the value attribute.

    <h:commandLink action="#{action.doActions}" value = "Novo Usuário" />