Reverse routing
Play provides a feature to make HTTP calls using Scala methods. For every route defined, an equivalent Scala method is generated in the routes_ReverseRouting.scala
file. This is very convenient when making a request from within our Scala code, for example, within views such as the following:
@(tasks: List[Task], taskForm: Form[String]) @import helper._ @main("Task Tracker") { <h2>Task Tracker</h2> <div> @form(routes.TaskController.newTask) { @taskForm.globalError.map { error => <p class="error"> @error.message </p> } <form> <input type="text" name="taskName" placeholder="Add a new Task" required> <input type="submit" value="Add"> </form> } </div> <div> <ul> @tasks.map { task => ...