You have two options (in any case, you need to change your template)
The first hides the HTML src in the view:
public static Result foo() { return ok(foo.render("<h1>Foo</h1>")); }
View foo.scala.html :
@(myHeader: String) @Html(myHeader)
The second passes the ready-to-use Html parameter:
import play.twirl.api.Html; //.... public static Result bar() { return ok(bar.render(Html.apply("<h1>Bar</h1>"))); }
View bar.scala.html
@(myHeader: Html) @myHeader
source share