0
votes

Hi I am new to Play Framework and till now experience is really bad with it. Every tutorial that I watch or do I get some stupid errors which I cannot fix. I am a step away from leaving this play framework. Anyway this is my last error that I got:

If I go to localhost:9000/example i get this error

Action not found For request 'GET /example' These routes have been tried, in this order:

1GET/controllers.Application.index()
2GET/example/controllers.Application.example()
3GET/assets/$file<.+>controllers.Assets.at(path:String = "/public", file:String)

My Application.java looks like that:

 package controllers;

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

import views.html.*;

public class Application extends Controller {

    public static Result index() {
        return ok(index.render("Play Tutorial :)"));
    }

    public static Result example(){

        String s = "Hello Mr View";
        return ok(fun.render(s));
    }

}

This is my routes file:

# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~

# Home page

GET     /                           controllers.Application.index()
GET     /example/                   controllers.Application.example()

# Map static resources from the /public folder to the /assets URL path
GET     /assets/*file               controllers.Assets.at(path="/public", file)

And this is my fun.scala.html file:

@(message: String)

<h1>@message</h1>

I am doing this from this tutorial: http://www.youtube.com/watch?v=mST2YmQYgS8&list=PL177265F762D05F72

1

1 Answers

0
votes

You need to remove slash at the end of resource name in routes file like this

GET     /example                   controllers.Application.example()