Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails g:each , Using fieldvalue or direct access Difference

Tags:

grails

gsp

<g:each in="${business}" status="i" var="businessInstance">
<tr class="${(i % 2) == 0 ? 'odd' : 'even' }">
<td>${fieldValue(bean: businessInstance, field: "id") }</td>
<td>${businessInstance.id}</td>
</tr>
</g:each>

In above example, both first and second table data results same value. Is there any difference in those two cases?

like image 997
Dipendra Pokharel Avatar asked Aug 08 '13 07:08

Dipendra Pokharel


1 Answers

fieldValue escapes the value by calling encodeAsHTML() to guard against XSS attacks, so it's much safer to use. It also formats numbers according the the current locale.

like image 124
Burt Beckwith Avatar answered Nov 18 '22 04:11

Burt Beckwith