Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 458
AFP_555 Avatar asked Dec 19 '25 05:12

AFP_555


1 Answers

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>

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!