The main page :ModelAndView mav = new ModelAndView("dashboard/layout");
The panel page:ModelAndView mav = new ModelAndView("dashboard/panel");
layout.jsp
<style>.....</style>
<!-- Panel display -->
<div class="container row" id="container"></div>
<script>.....</script>
panel.jsp
<c:forEach var="panel" items='${panelData}'>
<div class="panel-container col-lg-${panel.size}">
..samplecontent...
</div>
</c:forEach>
i want to show the list of panel in the panel.jsp
page but needs to be inside the layout.jsp
so that as to get all the style and functionalities from the layout.jsp
instead of the panel.jsp
The problem :Controller code
@RequestMapping("DashboardController/loadLayout")
public ModelAndView loadLayout() {
System.out.println("====Inside DashboardController#loadLayout====");
//list of dashboards
List<Dashboard> dashboards = dashboardManagerService.findAllActive();
ModelAndView mav = new ModelAndView("dashboard/layout");
Set<Panel> panelData = new HashSet<>();
for (Dashboard dashboard : dashboards) {
//panelData from the dashboard
panelData.addAll(dashboard.getLayoutPanels());
}
if (!panelData.isEmpty()) {
System.out.println("inside the else part " + panelData);
return editPanel(panelData);
} else {
System.out.println("inside the if part " + panelData);
}
return mav;
}
public ModelAndView editPanel(Set<Panel> panelData) {
System.out.println("====Inside DashboardController#editPanel====");
ModelAndView mav = new ModelAndView("dashboard/panel");
mav.addObject("panelData", panelData);
mav.setViewName("dashboard/panel");
return mav;
}