Thursday, 14 October 2010

STS Grails Tip - Formatting error in GSP

In a GSP the following causes the Springsource Tool Suite GSP Editor to incorrectly display an error:
<td class="prop">
  <g:textField name="dimensions[${i}].value" 
  value="${fieldValue(bean: q, field: 'value')}" />
</td> 
This is due to the construct [${i}], to resolve the problem wrap the i variable in braces [${(i)}]

<td class="prop">
  <g:textField name="dimensions[${(i)}].value" 
  value="${fieldValue(bean: q, field: 'value')}" />
</td> 
The error then disapears.