jsf - Semantics of "?faces-redirect=true" in <commandlink action=...> and why not use it everywhere -


i understand semantics behind appending "?faces-redirect=true" in action property of <h:commandlink> tag in jsf2.0. whether or out it, application indeed navigates target page specified in action. @ first glance seems effect cosmetic, i.e. provide feedback user (if looking @ browser's visited url) has moved new page. if innocuous , side-effects-free cannot see why not default behaviour. suspect has post-based mechanism of jsf2.0. 've noticed when browsing through jsf application urls 1 sees @ browser (when ?faces-redirect=true not used) ones of "previous" "page".

meta-nb. behind firewall , plagued "so requires external javascript domain" issue apologize absence of formatting. provide feedback on answers in few hours, when can access domain.

page-to-page navigation should not performed using post @ all. should using normal <h:link> or <h:button> instead of <h:commandlink> or <h:commandbutton>.

so instead of

<h:commandlink value="next page" action=nextpage.xhtml?faces-redirect=true" /> 

you should using

<h:link value="next page" outcome="nextpage.xhtml" /> 

this has major benefit website seo friendly. searchbots namely doesn't index forms.

use <h:commandlink> only if need submit form user input. more result presented in same page, if necesary conditionally rendered/included. on successful submits absolutely needs go different page (e.g. login/logout), should indeed sending redirect. so-called post-redirect-get pattern.

see also


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -