Approaches to build breadcrumbs

穿精又带淫゛_ 提交于 2019-12-25 03:50:29

问题


I have been working on a website which is basically a learning portal and user will have certain lessons inside certain category. My requirement is to build breadcrumbs on the pages. I don't want to hard code at every page.

So could anybody suggest what are the approaches I can use to build breadcrumbs dynamically?

I am using Spring-mvc.


回答1:


Usually, if you're talking dynamic breadcrumbs, they are generated by the server-side technology, rather than purely client-side. The server is going to know the exact page structure and what pages are parents of the current pages.

It'd be more unusual and difficult to do entirely client-side, but certainly possible. You might be able to do something like scrape the URL structure to determine parent pages. For example, if they are at /lessons/lesson1/intro you might split that string, compare each value against some dictionary of "Nice" values, and display "Lessons > Lesson 1 > Intro"



来源:https://stackoverflow.com/questions/15792114/approaches-to-build-breadcrumbs

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