简体   繁体   中英

Importing a sub-class in scala template -Play framework

I have a package named IndProcess and in that package I have a class IndicatorProcess . In this class I have a sub-class ExcelInd so it looks like this IndProcess.IndicatorProcess.ExcelInd . I am trying to pass an ArrayList<'ExcelInd'> to the Scala template that I have . 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. 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)

public static Result indicatorBrowse(){     
return ok(indicatorUpload.render(0,new ArrayList<ExcelInd>()));}

Thanks :)

The import statements should go after the template arguments. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM