println in grails gsp file

Srinath picture Srinath · Apr 27, 2010 · Viewed 11.2k times · Source

I know this is simple thing, but i was not aware.

I used println in gsp file and expected to print output in console. But this is showing on page.

<% 
for(int i =0; i < threads.size();i++) {
     println i
} 
%>

thanks.

Answer

sbglasius picture sbglasius · Apr 27, 2010

You can use

<%
   System.out.println i 
%>

But why use sniplets in a GSP page?

If you want console debug output from your GSP i suggest using this plugin: https://grails.org/plugin/debug