twirl

Playframework: Custom template path

匆匆过客 提交于 2019-12-25 07:38:17
问题 I was wondering if it is possible to override/add to the template paths for Playframework? For instance, the default templates are looked under views folder and are compiled automatically. These templates are further reachable directly using a URL without any additional config. ---app |-controllers |-models |-templates //How do I compile templates under this folder? |-views What I would like to know is if it is possible to add a custom path in addition to the views folder that is also

How to escape the “@” in play framework templates?

半腔热情 提交于 2019-12-08 14:55:55
问题 How to escape the @ in play framework templates (view and tags)? If you add a "@" in any view in play framework it will be automatically processed by the template processor. Even if is an email address or a twitter account. 回答1: Just repeat the @ for example as @@ : MyTestView.scala.html @() <html> <body> Follow me at @@myTwitter </body> </html> The information can be found at http://www.playframework.com/documentation/2.0/ScalaTemplates 来源: https://stackoverflow.com/questions/17077132/how-to

Why play framework 2.4 is so slow when using @routes.Assets.versioned in twirl?

别等时光非礼了梦想. 提交于 2019-12-08 07:56:49
问题 I have a controller, when i render a twirl template and return it in my action. the play performance decrease about 5 time (15000 Requests per second in apache benchmark). but when i return json in this action play performance increase about 5 time (79000 Requests per second in apache benchmark). I have a very simple twirl template: @(message: String) @main("Welcome to Play") { @message } Update : I find that when i use @routes.Assets.versioned instead of @routes.Assets.at to address assets

Play Framework trouble importing scala template from different package

流过昼夜 提交于 2019-12-08 04:07:39
问题 Using Play 2.3.7, I have a set of bootstrap3 templates similar to this example project, and they are in a package app/views/bootstrap3/ . One of these bootstrap3 templates is a text field object in a file named text.scala.html . In a separate package, I have some other templates in which I want to use my custom text field. So, in package app/views/other/ let's say I have I have a file index.scala.html , how do I correctly import my Bootstrap3 templates? This is what I have in my code @import