Memoc
Memoc

Reputation: 303

Looping in GSP grails

I have a gsp file called tool.gsp. I wanted to do loop to get some items value from ${tools} and store possibly in an array. I am new to groovy and gsp. I did a code portion as below to first try display those values but it failed.Can anyone help how I can implement looping in gsp and keep the looping result in an array?

<g:each in="${tools}" var="listed" status="counter">
    <div class="preview">
        ${tool.substate}
        ${tool.deviceName}
        ${tool.deviceNumber}
        ${tool.flowId}
        ${tool.handler}
        ${tool.loadboard}
        ${tool.currAlotNumber}
        ${tool.currAlotNumber[0]}
    </div>
</g:each>

Upvotes: 0

Views: 387

Answers (1)

z.eljayyo
z.eljayyo

Reputation: 1289

There is no 'tool' object, try renaming 'listed' to 'tool', eg:

<g:each in="${tools}" var="tool" status="counter">
<div class="preview">
    ${tool.substate}
    ${tool.deviceName}
    ${tool.deviceNumber}
    ${tool.flowId}
    ${tool.handler}
    ${tool.loadboard}
    ${tool.currAlotNumber}
    ${tool.currAlotNumber[0]}
</div>

Upvotes: 3

Related Questions