Variables and scopesDetails
applicationServletContext instance
applicationContextSpring ApplicationContext instance
flashThe flash object
grailsApplicationGrailsApplication instance
outresponse writer for writing to the output stream
paramsparams object for retrieving request parameters
requestHttpServletRequest instance
responseHttpServletResponse instance
sessionHttpSession instance
webRequestGrailsWebRequest instance


GSP supports the usage of <% %> scriptlet blocks to embed Groovy code (this is discouraged):

     <% out << "Hello GSP!" %>

You can also use the <%= %> syntax to output values, like in JSP:

     <%="Hello GSP!" %>

GSP also supports JSP-style server-side comments too:

     <%-- This is my comment --%>
     <%="Hello GSP!" %>


In GSP the <%= %> syntax is rarely used due to the support for GSP expressions.

A GSP expression is similar to a JSP EL expression or a Groovy GString and takes the form ${expr}:

    Hello ${}

However, unlike JSP EL you can have any Groovy expression within the ${..} block.

Any Groovy expression can be interpolated in all string literals, apart from single and triple single quoted strings. Interpolation is the act of replacing a placeholder in the string with its value upon evaluation of the string. The placeholder expressions are surrounded by ${} or prefixed with $ for dotted expressions. The expression value inside the placeholder is evaluated to its string representation when the GString is passed to a method taking a String as argument by calling toString() on that expression.

GSP Tags

There are variety of gsp tags available which can be used to create forms, textfield, radio buttons, check boxes, if-else, for each etc.


<g:if test="${session.role == 'admin'}">
   <%-- show administrative functions --%>
   <%-- show basic functions --%>


<g:each in="${[1,2,3]}" var="num">
  <p>Number ${num}</p>


<g:form name="myForm" url="[controller:'book',action:'list']">...</g:form>


<g:textField name="myField" value="${myValue}" />


<g:radio name="myGroup" value="1"/>

Follow this link for more info -