How to make if loop in grails?

Posted by user3569696 on Stack Overflow See other posts from Stack Overflow or by user3569696
Published on 2014-06-02T15:13:35Z Indexed on 2014/06/02 15:25 UTC
Read the original article Hit count: 277

Filed under:
|

I'm beginner in Grails, please help. I have this in my gsp

<div class="right66">                       
  <g:select class="time_pick" name="pick_day" placeholder="" from="${['Dani', 'Sati', 'Minute']}" valueMessagePrefix="book.category"/>

</div>

In translation: Dani=Days, Sati= Hours, Minute= Minutes. I need to save data in minutes but User have privilege to choose will his input be in minutes, days or hours. So i have to do if loop. I now how if loop works but i don't know how to wite it in grails. I was thinking something like this:

n=1
if(params.type=Dani){
n= 3600
}else if(params.type=Sati) {
n=60
}
def minute=params.minute*n

but how to call that choosen input "Dani"? I can't write Params.type=Dani. Does if loop go in controller in my case?

© Stack Overflow or respective owner

Related posts about grails

Related posts about if-statement