JSF 1.x版本中的书签URL [英] Bookmarking URL in the JSF 1.x version
问题描述
我知道从JSF 2.0可以在地址栏中更改URL.将URL标记为书签更有用.在JSF 1.x版本中有什么方法可以做.
I came to know that from JSF 2.0 the URL can be changed in the address bar. It is more helpful to bookmark the URL. Is there any way to do in the JSF 1.x versions.
推荐答案
否.但是,在JSF 1.x中,有一些常见的做法可以实现更好的可标记URL:
No. But there are some common practices to achieve better bookmarkable URL's in JSF 1.x:
-
提交后请勿导航到其他页面,请始终返回到相同页面,并按
h:message(s)
显示任何错误/成功消息.
Do not navigate to another page after submit, always return to the same page and display any error/success messages by
h:message(s)
.
如果提交后确实需要转到其他页面,则最好通过重定向来完成.它将导致浏览器在给定的URL上触发全新的GET请求.
If you really need to go to a different page after submit, prefer to do it by a redirect. It will cause the browser to fire a brand new GET request on the given URL.
请勿使用h:commandLink
/h:commandButton
(会触发POST)进行纯页到页的导航.使用h:outputLink
或仅使用纯HTML a
元素.对于SEO也更好.
Do not use h:commandLink
/h:commandButton
(which fire POST) for plain page-to-page navigation. Use h:outputLink
or just plain HTML a
elements. It's also better for SEO.
这篇关于JSF 1.x版本中的书签URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!