I would like to use GSP views instead of JSP/JSTL views in a plain old Spring MVC application. I have added a groovy.servlet.TemplateServlet to web.xml like this:
Instead of using a TemplateServlet
, you could have also used a GroovyPagesServlet
for that purpose (I haven't tested that, just looked at Grails' web.xml and the class' code).
The latter requires a Spring bean to be setup, named groovyPagesTemplateEngine
, and typed GroovyPagesTemplateEngine
(GStringTemplateEngine
in this case).
Configuring the view layer with an InternalResourceViewResolver
is correct. You'll have assigned a GroovyPageView
.
GSPs, by default, are not configured to perform HTML output escaping. To configure that, change grails.views.default.codec
from none
to html
in Config.groovy. See this article for more information.