AFP_555
AFP_555

Reputation: 2598

JSF Primefaces - Command button not redirecting

I have tried this command buttons and many more:

<p:commandButton value="Redirect" action="/tiposDocumentos.xhtml"/>

<p:commandButton value="Redirect" action="/administrador/tiposDocumentos.xhtml"/>

<p:commandButton value="Redirect" action="administrador/tiposDocumentos.xhtml"/>

I'm literarlly going nuts with this. I have other command buttons working like a charm, but this one is making me crazy!

This is my folder structure: enter image description here

When someone logs in as an administrator, is redirected to the file "initialMenu.xhtml" with this command button (which works)

<p:commandButton value="Sign - in" action="#{loginView.login}" update="msgGrowl" />

Then I don't know how to redirect to "TiposDocumentos.xhtml". Please, help.

I'm using SpringSecurity and other buttons that don't use the "login" method also work.

I can also redirect to "tiposDocumentos.xhtml" from login if I put it outside the "administrador" folder.

Upvotes: 3

Views: 2206

Answers (1)

user6369908
user6369908

Reputation:

Can you try "faces-redirect=true""as explained here and elsewhere

<p:commandButton id="btn_cr" 
        value="Redirect"
        ajax="false"
        action="/tiposDocumentos.xhtml?faces-redirect=true">
    </p:commandButton>

Upvotes: 2

Related Questions