public class VelocityLayoutViewResolver extends VelocityViewResolver
See VelocityViewResolver's javadoc for general usage info.
VelocityViewResolver
,
VelocityLayoutView
,
setLayoutUrl(java.lang.String)
,
setLayoutKey(java.lang.String)
,
setScreenContentKey(java.lang.String)
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
layoutKey |
private java.lang.String |
layoutUrl |
private java.lang.String |
screenContentKey |
FORWARD_URL_PREFIX, REDIRECT_URL_PREFIX
DEFAULT_CACHE_LIMIT
logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
VelocityLayoutViewResolver() |
Modifier and Type | Method and Description |
---|---|
protected AbstractUrlBasedView |
buildView(java.lang.String viewName)
Creates a new View instance of the specified view class and configures it.
|
protected java.lang.Class |
requiredViewClass()
Requires VelocityLayoutView.
|
void |
setLayoutKey(java.lang.String layoutKey)
Set the context key used to specify an alternate layout to be used instead
of the default layout.
|
void |
setLayoutUrl(java.lang.String layoutUrl)
Set the layout template to use.
|
void |
setScreenContentKey(java.lang.String screenContentKey)
Set the name of the context key that will hold the content of
the screen within the layout template.
|
initApplicationContext, setDateToolAttribute, setNumberToolAttribute, setToolboxConfigLocation
setAllowRequestOverride, setAllowSessionOverride, setExposeRequestAttributes, setExposeSessionAttributes, setExposeSpringMacroHelpers
canHandle, createView, getAttributesMap, getCacheKey, getContentType, getOrder, getPrefix, getRequestContextAttribute, getSuffix, getViewClass, getViewNames, isRedirectContextRelative, isRedirectHttp10Compatible, loadView, setAttributes, setAttributesMap, setContentType, setExposePathVariables, setOrder, setPrefix, setRedirectContextRelative, setRedirectHttp10Compatible, setRequestContextAttribute, setSuffix, setViewClass, setViewNames
clearCache, getCacheLimit, isCache, isCacheUnresolved, removeFromCache, resolveViewName, setCache, setCacheLimit, setCacheUnresolved
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
private java.lang.String layoutUrl
private java.lang.String layoutKey
private java.lang.String screenContentKey
protected java.lang.Class requiredViewClass()
requiredViewClass
in class VelocityViewResolver
VelocityLayoutView
public void setLayoutUrl(java.lang.String layoutUrl)
layoutUrl
- the template location (relative to the template
root directory)VelocityLayoutView.setLayoutUrl(java.lang.String)
public void setLayoutKey(java.lang.String layoutKey)
#set($layout = "MyLayout.vm" )
The default key is "layout", as illustrated above.
layoutKey
- the name of the key you wish to use in your
screen content templates to override the layout templateVelocityLayoutView.setLayoutKey(java.lang.String)
public void setScreenContentKey(java.lang.String screenContentKey)
Default is "screen_content": accessed in VTL as
$screen_content
.
screenContentKey
- the name of the screen content key to useVelocityLayoutView.setScreenContentKey(java.lang.String)
protected AbstractUrlBasedView buildView(java.lang.String viewName) throws java.lang.Exception
UrlBasedViewResolver
Spring lifecycle methods as defined by the bean container do not have to
be called here; those will be applied by the loadView
method
after this method returns.
Subclasses will typically call super.buildView(viewName)
first, before setting further properties themselves. loadView
will then apply Spring lifecycle methods at the end of this process.
buildView
in class VelocityViewResolver
viewName
- the name of the view to buildjava.lang.Exception
- if the view couldn't be resolvedUrlBasedViewResolver.loadView(String, java.util.Locale)