2012-09-26 26 views
1

我正在使用Play 2.0和Scala进行一个小项目,并且在显示逻辑中有点困难。我想检查我的视图引擎中传递的参数是否为空。播放2.0 - 检查传递的参数是否为空

我想:

@if(pmem.isEmpty()) { 
there are no past members who won in this branch 
} else { 
<table> 
etcc... 
<table> 
} 

,但它没有工作,给了我一个

布尔不带参数错误

我也尝试

@if(pmem == null) { 
there are no past members who won in this branch 
} else { 
    } else { 
    <table> 
    etcc... 
    <table> 
    } 

它没有工作,也许我错过了什么?否则我可能会做错全部。我正在使用Scala/Play 2.0框架。

+0

'@if(pmem.isEmpty){'给了我什么是“PMEM”类型的答案 – Krayons

+0

变量是它的集合?您可能会尝试调试并获取此变量的值。 –

回答

3
@if(pmem.isEmpty) { 
there are no past members who won in this branch 
} else { 
<table> 
etcc... 
<table> 
} 

尝试和给我的答案:)