Are there any JSF components for implementing brea

2019-04-06 16:47发布

问题:

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