back commandbutton in jsf

Andreas Petersson picture Andreas Petersson · Mar 16, 2009 · Viewed 20.1k times · Source

how would one implement a back-button as a commandbutton that works universally? with back button i don't mean the browser-button, but rather a button that sits somewhere on the page. it is not always possible to use the Post-redirect-get pattern.

its quite impractial to pass around the information on every single where the button should point to.

is there maybe a reserved keyword for a navigation rule that points to the last navigation rule applied?

Answer

alexmeia picture alexmeia · Mar 16, 2009

I use a h:commandLink with attribute onclick="history.go(-1)" in this case. It works universally.