Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Web 17/08/2018
package controllers;
import play.mvc.*;
/**
* This controller contains an action to handle HTTP requests
* to the application's home page.
*/
public class HomeController extends Controller {
public Result index() {
// return redirect("http://www.uol.com.br");
//return ok("<html><body>Funciona!</body></html>");
return ok(views.html.index.render("Ola Mundo"));
}
public Result olatads() {
return ok("Ola TADS");
}
public Result soma(Integer a, Integer b) {
return ok("Soma = " + (a + b));
}
}
@(s: String)
<html><head>
<title>Ola Mundo</title>
</head>
<body>
<h1 style="color:blue;">Funciona!!!</h1>
<h2>@s</h2>
@for(a<- 1 to 10){
<h3>@a</h3>
}
</body>
</html>
@*
@main("Welcome to Play") {
<h1>Welcome to Play!</h1>
}
*@
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# An example controller showing a sample home page
GET / controllers.HomeController.index
GET /olatads controllers.HomeController.olatads
GET /soma/:a/:b controllers.HomeController.soma(a: Integer, b: Integer)
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment