如何在Play Framework中更改模板引擎? [英] How do I change template engine in Play Framework?

查看:93
本文介绍了如何在Play Framework中更改模板引擎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Play中更改模板引擎!与默认的引擎不同的引擎?你能给出一个例子吗?

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

推荐答案

我甚至不问你为什么要那样做。

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

这很简单,Play可以返​​回结果包含您将提供的任何内容,因此您可以轻松使用:

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");

这篇关于如何在Play Framework中更改模板引擎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆