How can I use Option type as path pram in playframework?

(PSY) #1

I want to use an Option type as path param in routes file to call an action method in controller-

in routes file

GET /test/:x/:y       controllers.TestController.test(x:Int, y:Option[Int])

in controller -

def test(x:Int,y:Option[Int])=Action{. . . .}

but my compiler says me -

 implement an implicit PathBindable for this type..

How can I do this for Option Type ?

(Ivano Pagano) #2

From the manual I’m driven to think that optional parameters are encoded as query-params, whereas different alternative paths should be defined using separate routes.

(PSY) #3

thank you sir.