Krayons
Krayons

Reputation: 86

Play 2.0 - checking if passed parameter is null

I'm working on a little project using Play 2.0 and scala and having a bit struggle in display logic. I would like to check if my passed parameter is empty in my view engine.

I tried:

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

but it didn't work and gave me a

Boolean does not take parameters error

i also tried

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

and it didn't work, maybe I'm missing something? Or I could be doing it all wrong. I'm using Scala/Play 2.0 framework.

Upvotes: 1

Views: 3057

Answers (1)

Krayons
Krayons

Reputation: 86

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

tried and gave me the answer :)

Upvotes: 3

Related Questions