JSF URLs don't seem to change after the first click, only after the 2nd. E.g. when navigating from home.jsf
to auction.jsf
, the page being displayed is already auction.jsf
but the URL in the browser address bar stays at home.jsf
, until I click on the Auction link the second time. Why is this happening? Is there a way to disable it, and get the url to display correctly?
You seem to be navigating by POST instead of by GET. You should not perform page-to-page navigation by POST in first place. Replace <h:commandLink>
by <h:link>
.
So, do not navigate by
<h:form>
<h:commandLink value="Auction" action="auction" />
</h:form>
but by
<h:link value="Auction" outcome="auction" />
A JSF POST form basically submits to the current URL and any navigation is by default performed by a server-side forward using RequestDispatcher#forward()
(if you are well familiar with the basic Servlet API, you know what this means). You could work around with performing a redirect instead
<h:form>
<h:commandLink value="Auction" action="auction?faces-redirect=true" />
</h:form>
but, as said, this is a work around not a solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With