Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala playframework2模板,为什么简单字符串是ok的,而字符串为get compile的参数是错误的_Scala_Templates_Playframework 2.0 - Fatal编程技术网

Scala playframework2模板,为什么简单字符串是ok的,而字符串为get compile的参数是错误的

Scala playframework2模板,为什么简单字符串是ok的,而字符串为get compile的参数是错误的,scala,templates,playframework-2.0,Scala,Templates,Playframework 2.0,如果我的代码是: @(param: String) @main("hello world") { @slides("sssdfdes") <div class="list-group"> </div> 在这种情况下,如何在scala模板中传递变量字符串?只需使用@main(param)而不是@main(@param)这是因为您在一行中多次使用“@” Just use @main(param) instead of @main(@param) 以上@serejja给出

如果我的代码是:

@(param: String)

@main("hello world") {
@slides("sssdfdes")
<div class="list-group">
</div>

在这种情况下,如何在scala模板中传递变量字符串?

只需使用
@main(param)
而不是
@main(@param)
这是因为您在一行中多次使用“@”

Just use @main(param) instead of @main(@param)
以上@serejja给出了答案

[info] Set current project to slickplay (in build file:/C:/testprojects/slickpla
y/)
[info] Compiling 1 Scala source to C:\testprojects\slickplay\target\scala-2.10\c
lasses...
[error] C:\testprojects\slickplay\app\views\shopmain.scala.html:6: illegal start
 of simple expression
[error] @main(@param) {
[error]       ^
[error] C:\testprojects\slickplay\app\views\shopmain.scala.html:15: ')' expected
 but '}' found.
[error] two errors found
[error] (compile:compile) Compilation failed
[error] Total time: 3 s, completed 08/04/2014 8:24:11 PM
Just use @main(param) instead of @main(@param)