[英]Importing a sub-class in scala template -Play framework
I have a package named IndProcess and in that package I have a class IndicatorProcess . 我有一个名为IndProcess的程序包,并且在该程序包中有一个IndicatorProcessor类。 In this class I have a sub-class ExcelInd so it looks like this IndProcess.IndicatorProcess.ExcelInd .
在此类中,我有一个子类ExcelInd,因此它看起来像是IndProcess.IndicatorProcess.ExcelInd 。 I am trying to pass an ArrayList<'ExcelInd'> to the Scala template that I have .
我正在尝试将ArrayList <'ExcelInd'>传递给我拥有的Scala模板。 the code looks like this
代码看起来像这样
@import IndProcess.IndicatorProcess.ExcelInd
@import helper._
@import java.util._
@(aaa:String,count:Int ,indList: List[IndicatorProcess.ExcelInd])
The error occurs as "value not found aaa" so even if I remove the aaa and just pass count still it gives me the same error.I think I am not able to import it properly. 错误发生为“找不到值aaa”,因此即使我删除了aaa并仅传递计数,它也给了我同样的错误。我认为我无法正确导入它。 It is not able to recognize the type of List I am passing.
它无法识别我正在传递的列表的类型。 the calling function looks like this (currently I am just sending an empty Arraylist to display)
调用函数看起来像这样(当前我只是发送一个空的Arraylist来显示)
public static Result indicatorBrowse(){
return ok(indicatorUpload.render(0,new ArrayList<ExcelInd>()));}
Thanks :) 谢谢 :)
The import statements should go after the template arguments.
import语句应该模板参数后走了。 The template arguments must be the first line -- where it is now, it's being > parsed as a tuple with type ascriptions.
模板参数必须是第一行-现在是它的位置,正在>解析为具有类型说明的元组。
To be clear, imports were allowed to appear before the template's parameters shortly after this answer was written. 为了清楚起见,在编写此答案后不久,允许导入出现在模板的参数之前 。
https://github.com/playframework/twirl/pull/12 https://github.com/playframework/twirl/pull/12
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.