jsp - How to add breadcrumb to Spring MVC? -
how can add breadcrumb pages of spring mvc? suppose question ask breadcrumbs quite popular , might question of many others.
i've found solution using dummiesmind.breadcrumb.springmvc.annotations, there question on stackoverflow not learn except finding similar solution 1 ive found. solution this one using javascript.
does have better option ones mentioned?
@link(label="sample link", family="controllerfamily", parent=""); @requestmapping(value = "sample.do", method=requestmethod.get); public modelandview samplemethod(httpsession session){...}
what using display pages ? jsp ? thymeleaf ?
the link point seems option or @ least can build custom works based on that. using annotations keeps code clean need make sure add them everywhere.
you use abstract controller define method create modelandview
object pages. add breadcrumbs way :
protected modelandview createmodelandview(string pagename, breadcrumb breadcrumb) { modelandview modelandview = new modelandview(pagename); modelandview.addobject("breadcrumb", breadcrumb); return modelandview; }
of course need call method everytime in implementation.
one usage of pass request url parameter , parse build breadcrumbs associating text each part of path (using current local tanslate it). example "/admin/user/list" give home >> administration >> user management >> list of users. should easy build.
Comments
Post a Comment