I am creating a shopping cart application to learn Spring MVC. I want to display list of all categories(ex:Mobiles,Books,Stationery,Movies) and subcategories(Ex:iPhone,Motorola under Mobiles) in more than one page. i.e; Home Page, Products page, Category page.
I want to display this category and subcategories list in the header of my application so that I can use these in all the pages.(like below image)
In the Home Page controller I am retrieving the list of categories,subcategories and featured products and passing them to the home page.
I have 2 questions:
1.How can I store the object categoryMap in Spring to access it in multiple pages??
2. I have done the same project using JSP and Servlets and I have stored the categoryMap in application scope so that I can use it in multiple pages. Is this a right approach ? If not how can I do this in a better way ?