Suave Nti
Suave Nti

Reputation: 3747

HTML5 page with Playframework2.0.2

Trying to include simple HTML5 page instead of scala templates..

For this I have tried creating a simple HTML page in my views, But how can I redirect my app to this page ?

What I am trying to achieve is to use HTML pages as my UI and Play controller for POST and GET JSON data to the ui pages which will allow me to decouple UI

Upvotes: 1

Views: 250

Answers (1)

biesior
biesior

Reputation: 55798

See the routes file, on the end there is route for assets - static files like CSS, JS and images placed in public directory.

You can create similar folder for your static HTML files and add a separate route(s) the same as for assets.

You can also add your file into the views as ie. static_html5.scala.html and just don't add any scala functions to it (just to remember leave first line of the file empty) In such case only thing you'll need to remember is to replace any @ to @@ (ie.: My email is bob@@example.com )

In such case you can render it as a common template without params:

public static Result index(){
    return ok(static_html5.render());
}

Upvotes: 2

Related Questions