commandLink does not link to the screen

Asked

Viewed 76 times

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 I need to go to the next page, just gives 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 mistake is?

1 answer

0

So what I saw missing was the 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"; 
    }
}
  • Hasn’t given :/

  • You know a way I call the method #{usuarioBean.novo} through that command: <a href="publico/usuario.jsf" >Novo Usuário</a> Thus creating the link, but without any method.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.