Fork this page on GitHub

Spring MVC

Using Scalate with Spring MVC

Overview

Scalate with the Spring MVC framework. Spring MVC is a flexible MVC web application framework, built on core Spring functionality.

The ScalateViewResolver is an (AbstractCachingViewResolver)[http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/servlet/view/AbstractCachingViewResolver.html] that works similarly to an (UrlBasedViewResolver)[http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/servlet/view/UrlBasedViewResolver.html] to render Scalate templates.

View Resolver

The prefix and suffix properties are supported and default to empty Strings. The order property is also supported and defaults to org.springframework.core.Ordered.HIGHEST_PRECEDENCE.

The forward: and redirect: prefixes are not currently supported.

The ScalateViewResolver is configured as follows:

<bean class="org.fusesource.scalate.spring.view.ScalateViewResolver">
    <property name="prefix" value="/WEB-INF/views/scalate/" />
    <property name="suffix" value=".jade" />
</bean>

View resolver chaining is configured as follows (ScalateViewResolver is tried before InternalResourceViewResolver):

<bean class="org.fusesource.scalate.spring.view.ScalateViewResolver">
    <property name="order" value="1" />
    <property name="prefix" value="/WEB-INF/views/scalate/" />
    <property name="suffix" value=".jade" />
</bean>

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="order" value="2" />
    <property name="prefix" value="/WEB-INF/views/jsp/" />
    <property name="suffix" value=".jsp" />
</bean>