Are there any JSF components for implementing breadcrumb navigation?

こ雲淡風輕ζ 提交于 2019-12-21 11:40:54

问题


As far as I know there are two "kinds" of breadcrumbs.

The static/hierarchy one

  • Works like a stack
  • Entries are pushed when a user goes "deeper" into the site
  • Entries are poped when user goes "up" into the site
  • Is the same for all users (for a given page)
  • Shows location rather than history

A simple Example would be HOME -> BIG CATEGORY -> SMALL CATEGORY -> ARTICLE

The dynamic/historical one

  • Works like a queue
  • Entries are pushed at the end when a user goes to another page
  • Entries are removed from the front when the maximum size is reached
  • Is different for each user, since it is personalized.
  • Shows timeline/history instead of location.

A simple example would be SMALL CATEGORY -> HOME -> BIG CATEGORY -> HOME

The question is:

Are there any ready-made JSF component for these types of navigation?


回答1:


see primefaces, there are lot of components and you can find breadcrumb too http://www.primefaces.org:8080/showcase/ui/breadCrumb.jsf




回答2:


I have the same issue! But I feel like the solution will be the one mentioned by @BalusC

Now, I am using the breadcrumb only to get the current view path.

 <h:form id="breadcrumb">
                        <p:breadCrumb>
                            <p:menuitem value="#{bundle.Index}" action="/index?faces-redirect=true" immediate="true"/>
                            <p:menuitem value="#{view.viewId.substring(0, view.viewId.length()-6)}" url="#{view.viewId.substring(0, view.viewId.length()-6)}.jsf" ajax="false"/>

                        </p:breadCrumb>
                    </h:form>

I am using .jsf as Faces URL pattern and since the viewid = /*.xhtml**, I had to substring it, remove the .xhtml substring and add the .jsf string.

So we need a backing bean that does the job of getting the viewid (path) and put it in an ordered List. The use of javascript:history.back() and history.forward() is also possible!




回答3:


In this link you can find appropriate answer for your question i hope it will help next questioner



来源:https://stackoverflow.com/questions/2809743/are-there-any-jsf-components-for-implementing-breadcrumb-navigation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!