how can I pass an array from controller to gsp, and view it by index in that gsp?
Lets say 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 i call let say index [1] value "B" specifically in the gsp without any looping possibly?
You can try this.
You pass full array to view. And in your view, you do the following:
${flag[1]}
Or: you only pass the specific value to view. In your controller:
render(view: "test_preview",model:[flag:str[1])
And in your view:
${flag}