Semantics of “?faces-redirect=true” in and why not use it everywhere

前端 未结 1 719
臣服心动
臣服心动 2020-12-06 12:30

I would like to understand what are the semantics behind appending the \"?faces-redirect=true\" in the action property of a t

1条回答
  •  失恋的感觉
    2020-12-06 13:29

    Page-to-page navigation should not be performed using POST at all. You should be using normal or for this instead of or .

    So instead of

    
    

    you should actually be using

    
    

    This has the major benefit that the website is now SEO friendly. Searchbots namely doesn't index forms.

    Use the only if you need to submit a form with some user input. But more than often the result is just presented in the same page, if necesary conditionally rendered/included. Only on successful submits which absolutely needs to go to a different page (e.g. login/logout), you should indeed be sending a redirect. This is the so-called Post-Redirect-Get pattern.

    See also

    • How to navigate in JSF? How to make URL reflect current page (and not previous one)
    • When should I use h:outputLink instead of h:commandLink?

    0 讨论(0)
提交回复
热议问题