Search code examples
jsfstackbreadcrumbs

Implement dynamic breadcrumbs in jsf


I have several jsf pages. I need to add dynamic breadcrumbs to the header.xhtml. So till now I am able to get the current page's url. In the header.xhtml I push them in stack. So whenever a new page comes as header.xhtml is common it pushes the current url to the stack variable.

I can just iterate over the stack and pop the urls and show them. But I am confused over the rest. Whenever the user goes backward I have to pop, how can I implement this? If the user went to steps back I have to pop two times.

Am I on the right track? Is there any other solution?


Solution

  • I just added an if. If it was repeated then just pop up the rest. Now breadcrumbs work. The problems is now it just lists all the links. What if every time I go to the root, I want the tree path to start from there..