This seems silly, but I can not figure out why it is not working, I have the following project tree:
Inside dashboard.xhtml I have a button that has to redirect the user to RequisicoesEmAberto.xhtml.
This is what I tried when using a html button:
<button id="reqAbertoBtn" class="btnAcessoRapido" onclick="ClickEvent()">
<div class="iconeBtnAcessoRapido">
<i class="fal fa-folder-open"></i>
</div>
<span class="tituloBtnAcessoRapido">Requisições em Aberto</span>
</button>
function ClickEvent() {
window.location.href = '/evop/protected/compras/requisicao/RequisicoesEmAberto.xhtml';
}
However the page only refreshed, then I decided to try a PrimeFaces component for that, so I tried:
<p:commandButton icon="fal fa-folder-open" iconPos="top" value="Requisições em Aberto" action="/evop/protected/compras/requisicao/RequisicoesEmAberto.xhtml?faces-redirect=true"/>
So when I clicked the button an error saying that it was not possible to find the resource "/evop/protected/compras/requisicao/RequisicoesEmAberto.xhtml" occurred, but the page is there, you can access it if you type the url in the browser.
I also tried using outcome:
<p:button icon="fal fa-folder-open" iconPos="top" value="Requisições em Aberto" outcome="/evop/protected/compras/requisicao/RequisicoesEmAberto.xhtml"/>
and
<p:button icon="fal fa-folder-open" iconPos="top" value="Requisições em Aberto" outcome="../compras/requisicao/RequisicoesEmAberto.xhtml"/>
and
<p:button icon="fal fa-folder-open" iconPos="top" value="Requisições em Aberto" outcome="RequisicoesEmAberto.xhtml"/>
Needles to say that also gave me an error:
Could not resolve NavigationCase for outcome: /evop/protected/compras/requisicao/RequisicoesEmAberto.xhtml
I can't believe it is that hard to do a simple page redirect, what am I missing here?