Domanda

I've problem, I Always get the following error: "Action not found for request 'Get /neerslag/'". This is my routes file:

GET     /                           controllers.Application.index()
POST    /neerslag                   controllers.Application.saveNeerslag()
GET     /neerslag                   controllers.Application.getAllNeerslag()
GET     /neerslag/:id               controllers.Application.getNeerslag(id:Long)
GET     /neerslag/form              controllers.Application.showForm()

The "/" path works but none of the other works.

Here is my Application.java:

public static Result index() {
    return ok(index.render("text"));
}
public static Result saveNeerslag(){
    Neerslag neerslag = Form.form(Neerslag.class).bindFromRequest().get();
    neerslag.save();
    return redirect(routes.Application.index());
}
public static Result getAllNeerslag(){
    List<Neerslag> alleNeerslag = new Model.Finder(String.class, Neerslag.class).all();
    return ok(overview.render(alleNeerslag));
}
public static Result showForm(){
    Form<Neerslag> internalForm = Form.form(Neerslag.class);
    return ok(neerslagform.render(internalForm));
}
public static Result getNeerslag(Long id){
    Neerslag result = new Model.Finder<>(String.class, Neerslag.class).byId(""+id);
    return ok(neerslagDetail.render(result));
}

I tried the "play clean" and "play compile" command but this doesn't solve the error.

È stato utile?

Soluzione

This is a Play limitation, for now, if you want to call /neerslag/ you must to have this on your routes file:

GET     /neerslag                   controllers.Application.getAllNeerslag()
GET     /neerslag/                  controllers.Application.getAllNeerslag()

This is not very nice, but is the only way now.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top