grails GSP Tags


Example

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>

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

<g:each>

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

form

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

textField

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

radio

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

Follow this link for more info - http://docs.grails.org/latest/guide/theWebLayer.html#tags