当前位置: 首页 > 面试题库 >

Play 2.0 Framework模板引擎中的计算

尉迟子民
2023-03-14
问题内容

Play 2.0模板引擎是否支持html页面中的简单计算。

让我们说,我创建一个sum.scala.html页面:

@(a:String, b: String)

<html>
<head></head>
<body>
  <h1> answer is getSum(@a,@b) </h1>
</body>
</html>

有什么办法可以通过某些函数“获取a和b的和”?或是否有任何play 2.0专家知道关于play 2.0模板引擎中计算的任何好主意?谢谢


问题答案:

你试过了@(a.toInt + b.toInt)吗?



 类似资料:
  • 具体查看ejs官方文档 https://github.com/mde/ejs

  • 我们自己实现了一个轻量级的模板引擎,不要问为什么不用smart之类的,因为我们认为没有必要为了一个小小的模板引擎而引入smaart这样复杂的实现。你可能会说,smart功能强大,支持各种标签,标签也是很强大,而且还可以对模板引擎进行各种"灵活"的配置... 这里我们觉得有必要说明一下: 框架的内置模板引擎基本上实现了我们日常开中所有常用的标签。 不常用的标签我们也做了巧妙的实现。 我们只提供了扩展

  • 内置模板引擎 视图的模板文件可以支持不同的解析规则,默认情况下无需手动初始化模板引擎。 可以通过下面的几种方式对模板引擎进行初始化。 配置文件 内置模板引擎的参数统一在配置目录的template.php文件中配置,例如: return [ // 模板引擎类型 支持 php think 支持扩展 'type' => 'Think', // 模板路径 '

  • Warning: The packages listed below may be outdated, no longer maintained or even broken. Listing here does not constitute an endorsement or recommendation from the Expressjs project team. Use at your

  • Use the app.engine(ext, callback) method to create your own template engine. ext refers to the file extension, and callback is the template engine function, which accepts the following items as parame

  • hi-nginx-java内置了两个mustache模板引擎:mustache.java和jmustache。 以下介绍仅就jmustache而言。 字符串模板 字符串模板是最简单的情况。例如: package test; import hi.request; import hi.response; import hi.route; import java.util.regex.Matcher