Play 2.0 框架模板引擎中的计算 [英] Calculation in Play 2.0 Framework template engine

查看:19
本文介绍了Play 2.0 框架模板引擎中的计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Does play 2.0 template engine support the simple calculation in the html page.

比方说,我创建了一个 sum.scala.html 页面:

Let us say, I create a sum.scala.html page:

@(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 模板引擎中计算的任何好主意?谢谢

Is there any way that we could "getSum of a and b" via some function? or Does any play 2.0 expert know any good idea about calculation in play 2.0 template engine? Thanks

推荐答案

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

这篇关于Play 2.0 框架模板引擎中的计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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