Reputation: 13
I am beginner at java play framework
and I have a trouble with it's working logic.
I created a new project with activator new and I'm working on its default format. When I start the project on localhost:9000
it's working.
First, controllers become active then specific functions(HomeController.index() or CountController.count())
starts. I can not see the connection between which HTML
files, which are under views package, should be use.
How can the program understand specifically which HTML file use by calling controllers function?
Upvotes: 1
Views: 385
Reputation: 492
In the play framework, there is a routes file in the /conf directory, where the url is mapped to the controller. For example, in your routes file, there is a map like this
GET /index controller.index()
when you type the following url in browser
localhost:9000/index
the play framework will map the '/index' to the controller index(). Then you can handle the request with the help of index() controller, which can return an html with specified path to the browser.
public static class index() extends Controller {
return Ok(views.html.index);
}
This above is that how the play framework returns an html.
Good luck
Upvotes: 1