I am newbie to Play 2 framework. How can I print ‘HELLO WORLD’ text in web browser without using any view file.
I have setup route file as below :
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / controllers.Mantra.index()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
My controller is as below:
package controllers;
import play.*;
import play.mvc.*;
import play.data.*;
import play.data.validation.Constraints.*;
import java.util.*;
import views.html.*;
public class Mantra extends Controller {
public static Result index(){
return ok(index.render("HELLO WOLRD"));
}
}
I have tried many times, but it is still showing default page. Can some one guide what Iam doing wrong and how it can be rectified.
Thanks in advance
Use:
ie, call the ok() method which take only a String as parameter.