I want to show date on main.gsp. Do I just call g:formatDate? Because I did that but date is not rendered:
<span id='loginLink' style='position: absolute; right: 20px; top: 20px;'>
<sec:ifLoggedIn>
You are logged in as:<sec:username/> (<g:link controller='logout'>Logout</g:link>)
</sec:ifLoggedIn>
<sec:ifNotLoggedIn>
<g:link controller='login'>Login</g:link>
</sec:ifNotLoggedIn>
</span>
<span style='position: absolute; right: 20px; top: 40px;'>
Date:<g:formatDate format="yyyy-MM-dd" date="${date}"/>
</span>
Are you sure that the ‘main’ controller action returns the ‘date’ variable containing the actual date? For example:
Another solution would be to instanciate the Date class directly in your gsp code.