|
FiveMinuteTurorial
Five Minute Tutorial
The following assumes we have a working installation of Aerie in a directory called aerie-webapp Inside aerie-webapp execute ant server. This will start an instance of Jetty, the web server that comes packed with Aerie, on port 8080. Create the following file: aerie-webapp/src/controllers/Hello.groovy : import aerie.controller.Controller
class Hello extends Controller {
public greeting
def index() {
greeting = "Hello World"
render ("hello/index.html")
}
}The above code defines a Controller named Hello, with an Action named index. We are telling the index Action to render a Page - hello/index.html, so let's create it. aerie-webapp/pages/hello/index.html : <html>
<head>
<title>Hello</title>
</head>
<body>
<h1><%= greeting %></h1>
</body>
</html>greeting is the public field we defined in the Hello Controller. All Controller fields that are declared public will be available to the views, i.e. the Pages. Point a web browser to http://localhost:8080/hello and lo the results of our labour. TDD Hello World In Aerie demonstrates our preferred, Test-First version of the above example. |
Sign in to add a comment
