How do I change template engine in Play Framework?

こ雲淡風輕ζ 提交于 2019-12-07 05:02:28

问题


How would I change the template engine in Play! to a different engine than the default one? Can you give an example?


回答1:


I don't even ask why you want to do that.

That's simple, Play can return Result with ANY content you will give it, so you can just easily use:

return ok("<h1>Code rendered from your alternative engine</h1>").as("text/html");



回答2:


It depends on which template engine you want to use. There are a number of options in Play's Module Directory.



来源:https://stackoverflow.com/questions/21947850/how-do-i-change-template-engine-in-play-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!