开发者

Bookmarking URL in the JSF 1.x version

I came to know that from JSF 2.0 the URL can be changed in the address 开发者_JAVA百科bar. It is more helpful to bookmark the URL. Is there any way to do in the JSF 1.x versions.


No. But there are some common practices to achieve better bookmarkable URL's in JSF 1.x:

  • Do not navigate to another page after submit, always return to the same page and display any error/success messages by h:message(s).

  • 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.

  • 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.


If you are willing/able to extend your JSF 1.2 installation, you could also take a look at PrettyFaces (http://ocpsoft.com/prettyfaces/), which adds a lot of extra support for bookmark-able URLs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜