In the beginning we get the template page as shown, but in the given template, each page contains the left side of the sidebar code, which when we develop the system, obviously can not do so, not conducive to change, the repeatability is also very large, but if it is placed in a file in a unified inclusion in the words, It's about how to make the sidebar correctly check the link to the current page, instead of manually setting the tab switch.
By looking at the template source code, found a function setsidebarmenuactivelink, in the sidebar selection link, set an ID for each of the links, the code is as follows:
<li class= "Start active open" ><a href= "javascript:;" ><i class= "Icon-home" ></i><span class= "title" > Stock </span><span class= "selected" > </span><span class= "Arrow open" ></span></a><ul class= "sub-menu" ><li class= "" > <a href= "${pagecontext.request.contextpath}/index" id= "gpsj_page" ><i class= "Icon-bar-chart" ></i > Stock Data </a></li><li class= "" ><a href= "${PAGECONTEXT.REQUEST.CONTEXTPATH}/GP/JYFW" id= "Jyfw_ Page "><i class=" Icon-bar-chart "></i> business scope </a></li><li class=" "><a href=" ${ Pagecontext.request.contextpath}/gp/k_line "id=" gp_kline_page "><i class=" Icon-bar-chart "></i> Stock K Line chart </a></li><li class= "" ><a href= "${pagecontext.request.contextpath}/common/hotwords.jsp" Id= "Common_hot_words_page" ><i class= "Icon-bar-chart" ></i> hot search Words </a></li></ul>< /li>
, and then, when each page loads, add a layout.setsidebarmenuactivelink (' Set ', $ (' #common_hot_words_page '));
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Bootstrap template Metronic Set default check Sidebar