j.jerrod.taylor
j.jerrod.taylor

Reputation: 1140

Playframework giving error in dynamic route

I'm trying to make an application using Play and I'm getting an error with one of my dynamic routes so my application isn't compiling. I read the documentation here and it looks like I'm doing everything correctly.

Below is the line in my routes file that is giving me the error.

POST    /user/delete/:id            controllers.MainController.deleteUser(:id Long)

Below is the controller that is being called in the routes file.

package controllers;

import play.mvc.Controller;
import play.mvc.Result;

public class MainController extends Controller {

    public static Result index() 
    {
        return ok(views.html.index.render("Hello from Java"));
    }

    public static Result users()
    {
        return TODO;    
    }

    public static Result newUser()
    {
        return TODO;    
    }

    public static Result deleteUser(Long id)
    {
        return TODO;
    }

}

It keeps on telling me conf/routes:10: Compilation error[)' expected but:' found]

Upvotes: 0

Views: 166

Answers (1)

Rado Buransky
Rado Buransky

Reputation: 3294

Colon in the method signature isn't placed correctly. It should be:

POST    /user/delete/:id            controllers.MainController.deleteUser(id: Long)

Upvotes: 2

Related Questions