I have a static menu in the sidebar which I include in every JSF page. The menu looks like so:
<li class="nav-header">Item 1</li>
<li class="active"><a href="index.xhtml">Item 2</a></li>
<li><a href="new_workload.xhtml">Item 3</a></li>
<li><a href="import_workload.xhtml">Item 4</a></li>
Adding a class="active"
to the <li>
highlights the menu. How do I go about making sure selected item is highlighted dynamically in JSF2?
I know PrimeFaces and RichFaces have ready made components for this, but I want to try a pure JSF 2 solution first. A pure client side JavaScript solution is also acceptable.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…