Play 2.0, get active route / url / Call?

I am creating a paginator for my application.

I cannot figure out how to get the current route / indicate whether the page / Call is active.

Code in index.scala.html

@if(page.getTotalPageCount() > 0){
<div class="pagination">
    <ul>
    @for(i <- 0 to page.getTotalPageCount()-1){
        <li@if(@routes.NewsHandler.index(i) == ?){ class="active"}><a href="@routes.NewsHandler.index(i)">@(i+1)</a></li>
    }
    </ul>
</div>
}

So basically.

if(@routes.NewsHandler.index(i) == ?){ class="active"}

Any ideas?

EDIT, I found a working solution:

@if(request().path().toString().equals(routes.NewsHandler.index(i).toString())){ class="active"}
+5
source share
1 answer

There is currently no standard way to find out the current one Handlerfor a request.

-1
source

All Articles