playframework 2.0 - How to define (in routes) passing multiple Long values from a view template -


in play 2.0.4 project have view template takes 2 values in parameters, list , long.

@(listofbooks: list[book], oid: long) 

i know correct values being passed because print them in main body of template inside loop , display expect.

@for(book <- listofbooks) {      <li>         <b>original id: </b>@oid<br>         <b>new id: </b>@book.id<br>      </li> 

i trying invoke controller method view values oid , book.id.

i have controller method defined handle , invoke when button pressed.

<a href routes.application.addassociate(oid, book.id)"> button </a> 

i have tried number of things in router file can't work. current application route defined:

get     /addassociate/:oid/:id                   controllers.application.addassociate(oid: long, id: long) 

when button described above pressed url in browser changes this:

http://localhost:9000/routes.application.addassociate(oid,%20book.id) 

and error message:

action not found request 'get /routes.application.addassociate(oid,%20book.id)'

i think problem how defining connection in router file not sure how pass multiple long values.

you're missing magic @ character in view template indicating url dynamic:

<a href="@routes.application.addassociate(oid, book.id)"> button </a> 

Comments