Unable to resolve reverse routing methods in IntelliJ

前端 未结 7 1001
粉色の甜心
粉色の甜心 2020-12-14 10:10

I\'m following one of the play framework tutorials, but I\'m getting compile errors whenever I try to use reverse routing. Firstly,

public static Result java         


        
7条回答
  •  隐瞒了意图╮
    2020-12-14 10:27

    This question was asked a year ago, but to answer for future queries by other coders, the problem is easily solved by adding a "play.Routes" path like this

    public static Result javascriptRoutes() {
        response().setContentType("text/javascript");
        return ok(
                play.Routes.javascriptRouter("jsRoutes",
    
                        // Routes for Projects
                        controllers.routes.javascript.Projects.add(),
                        controllers.routes.javascript.Projects.delete(),
                        controllers.routes.javascript.Projects.rename(),
                        controllers.routes.javascript.Projects.addGroup()
                )
        );
    

    }

    Ensure that you have the proper imports to the class:

    import play.mvc.*;
    import play.data.*;
    

提交回复
热议问题