In my controller I have a delete method:
delete(String id, boolean confirmed)
Now in the routes I want to map two URIs accordingly:
GET /item/:id/delete controllers.Application.delete(id:String, false)
GET /item/:id/delete/confirmed controllers.Application.delete(id:String, true)
(interesting part is the second parameter passed to the delete method depending on the URI)
This however gives me the following error:
identifier expected but 'false' found.
What am I doing wrong?
Correct syntax is:
GET /item/:id/delete controllers.Application.delete(id:String, confirmed:Boolean ?= false)
GET /item/:id/delete/confirmed controllers.Application.delete(id:String, confirmed:Boolean ?= true)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With