Top Description Constructors Methods
org.springframework.web.servlet.view.freemarker

public Class FreeMarkerViewResolver

extends AbstractTemplateViewResolver
Class Inheritance
Imports
org.springframework.web.servlet.view.AbstractTemplateViewResolver, .AbstractUrlBasedView

Convenience subclass of org.springframework.web.servlet.view.UrlBasedViewResolver that supports FreeMarkerView (i.e. FreeMarker templates) and custom subclasses of it.

The view class for all views generated by this resolver can be specified via the "viewClass" property. See UrlBasedViewResolver's javadoc for details.

Note

When chaining ViewResolvers, a FreeMarkerViewResolver will check for the existence of the specified template resources and only return a non-null View object if the template was actually found.

Author
Juergen Hoeller
Since
1.1
See Also
setViewClass, setPrefix, setSuffix, setRequestContextAttribute, setExposeSpringMacroHelpers, FreeMarkerView

Constructor Summary

AccessConstructor and Description
public
public
FreeMarkerViewResolver(String
the prefix that gets prepended to view names when building a URL
prefix
,
String
the suffix that gets appended to view names when building a URL
suffix
)

A convenience constructor that allows for specifying prefix and suffix as constructor arguments.

Method Summary

Modifier and TypeMethod and Description
protected AbstractUrlBasedView
protected Class<?>
Inherited from org.springframework.web.servlet.view.AbstractTemplateViewResolver:
buildViewsetAllowRequestOverridesetAllowSessionOverridesetExposeRequestAttributessetExposeSessionAttributessetExposeSpringMacroHelpers

Constructor Detail

FreeMarkerViewResolverback to summary
public FreeMarkerViewResolver()

Sets the default view class to requiredViewClass: by default FreeMarkerView.

FreeMarkerViewResolverback to summary
public FreeMarkerViewResolver(String prefix, String suffix)

A convenience constructor that allows for specifying prefix and suffix as constructor arguments.

Parameters
prefix:String

the prefix that gets prepended to view names when building a URL

suffix:String

the suffix that gets appended to view names when building a URL

Since
4.3

Method Detail

instantiateViewback to summary
protected AbstractUrlBasedView instantiateView()

Overrides org.springframework.web.servlet.view.UrlBasedViewResolver.instantiateView.

Doc from org.springframework.web.servlet.view.UrlBasedViewResolver.instantiateView.

Instantiate the specified view class.

The default implementation uses reflection to instantiate the class.

Returns:AbstractUrlBasedView

a new instance of the view class

Annotations
@Override
requiredViewClassback to summary
protected Class<?> requiredViewClass()

Overrides org.springframework.web.servlet.view.AbstractTemplateViewResolver.requiredViewClass.

Requires FreeMarkerView.

Annotations
@Override