Saturday, 15 January 2011

jsp - How to add breadcrumb to Spring MVC? -


How do I add breadcrumbs to all pages of Spring MVC? I think that this is a good question as breadcrumbs are quite popular and this may be the question of many other people.

I have found out that Damijmind. The breadcrumb. Prong is using MVC nanotation, it is also on Stackeflfflow, but Ive found that I can not learn a lot without leaving the same solution. Another solution is to use Javascript.

Did I give them a better option?

  @ link (label = "sample link", family = "controller family", original = ""); @RequestMapping (value = "sample.do", method = RequestMethod.GET); Public Model and Subject Numerical (HTP session session) {...}  

Are your pages displaying? JSP? Thymeleaf?

You can think of a good alternative link or at least you can create some custom that works for you based on that annotation keeps your code clean but ensures you To do that you add them everywhere.

You can use an intuitive controller, where you can define a method for creating ModelAndView objects for all pages. You can add such breadcrumbs:

  Build protected models and views and view (string page name, breadcrumbs rotiComba) {model and visual model and view = new model and view (page name); ModelAndView.addObject ("breadcrumb", breadcrumb); Return Model Endview; }  

Of course you will need to call that method every time in your implementation.

Use it as a parameter to pass your request URL and it will have to be parse Create breadcrumbs by adding text of each part of the path (using existing locale to tease it) So for example "/ admin / user / list" will give you Home> Administration> User Management> Users list. It should be easy to make


No comments:

Post a Comment