views:

288

answers:

3

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.

+2  A: 

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.

Rolf
A: 

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.
Bozho
A: 

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.

Mark McLaren