Best practice to manage the path breadcrumbs in Spring without Web flow

不想你离开。 提交于 2019-12-08 18:41:51

问题


I am engaged in a project where I need to show path bread crumbs to the user like

Home (This is linked to home page) >> (page name)

and like

Home >> contacts

and in contacts like

Contacts >> create
Contacts >> edit

etc.

Is there a best practice how to do this in spring without he usage of spring web flow? I am not using spring web flow and simply using the spring MVC.


回答1:


I'm not sure why you'd have to do this in Spring if you're not using Spring MVC.

Depending on the site's structure and the URL structure, you might want to parse the URL into something readable.

Another option is to have some sort of push/pop mechanism but since browsers have a back button which does not signal the server this is often a recipe for disaster.




回答2:


I'm not sure there is any universal solution for breadcrumbs. Here are a few variants:

  • use the URL structure. With spring mvc this is actually a very good option, since it (since 2.5) replies a lot on nice, structured URLs
  • have each page (view) identify its own path in the breadcrumb (via a request parameter). It's not
  • place current steps in session. This would break if multiple tabs/windows are used, so you will have to use a windowId.. and essentially roll-out a "crippled" webflow.



回答3:


This sort of breadcrumbs is sometimes called homeward path navigation.

If you can capture your site layout in XML then an XSL could be used to generate the breadcrumbs. The same XML site layout document could also be used to generate a side navigation menu.

See also: Separating breadcrumb (homeward path) navigation from content using XML/XSL.



来源:https://stackoverflow.com/questions/2933943/best-practice-to-manage-the-path-breadcrumbs-in-spring-without-web-flow

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