Rectangle 27 0

If you know all parameters you can create form mapping and use fold method to get all values. It works with a GET method as well. In this case it would look like this

Case class for holding url params with form mapping:

import play.api.data.Form
import play.api.data.Forms._

case class UrlForm(email: String, firstName: String, lastName: String)

object UrlForm {
  val form = Form[UrlForm](
    mapping(
      "email" -> text,
      "first-name" -> text,
      "last-name" -> text
    )(UrlForm.apply)(UrlForm.unapply)
  )
}
object UrlController {
  def widget() = Action { implicit request =>
      UrlForm.form.bindFromRequest.fold(
        formWithErrors => // validation errors
        urlForm => urlForm.email; urlForm.lastName //etc.
      )
  }
}

Notice that you are able to map url params to any type you want. String is just an example.

scala - play framework get parameter in url with dash - Stack Overflow

scala url playframework playframework-2.0