You can get the current view id in EL as follows
#{view.viewId}
So this should do
class="#{view.viewId eq '/index.xhtml' ? 'active' : ''}"
It would be easier to keep all these links in some List<Page> so you can just do something like
<li class="nav-header">#{menu.header}</li> <ui:repeat value="#{menu.pages}" var="page"> <li class="#{view.viewId eq page.viewId ? 'active' : ''}"> <h:link value="#{page.title}" outcome="#{page.viewId}" /> </li> </ui:repeat>
instead of copying the same piece of code over and over.
Balusc
source share