grails - GSP pass Array from controller and display in gsp by its index -


how can pass array controller gsp, , view index in gsp?

lets in controller:

string[] str= new string[2]; str[0]="a" str[1]="b"  render(view: "test_preview",model:[flag:str]) 

and in gsp, how can call let index [1] value "b" in gsp without looping possibly?

you can try this.

  1. you pass full array view. , in view, following:

    ${flag[1]} 
  2. or: pass specific value view. in controller:

    render(view: "test_preview",model:[flag:str[1]) 

    and in view:

    ${flag} 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -