类 VelocityLayoutView
- 所有已实现的接口:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.web.context.ServletContextAware,org.springframework.web.servlet.View
The url property should be set to the content template
for the view, and the layout template location should be specified as
layoutUrl property. A view can override the configured
layout template location by setting the appropriate key (the default
is "layout") in the content template.
When the view is rendered, the VelocityContext is first merged with
the content template (specified by the url property) and
then merged with the layout template to produce the final output.
The layout template can include the screen content through a VelocityContext variable (the default is "screen_content"). At runtime, this variable will contain the rendered content template.
- 从以下版本开始:
- 1.2
- 作者:
- Darren Davison, Juergen Hoeller
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明static final String已过时。The defaultlayout key.static final String已过时。The defaultlayout url.static final String已过时。The defaultscreen content key.从类继承的字段 org.springframework.web.servlet.view.AbstractTemplateView
SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE从类继承的字段 org.springframework.web.servlet.view.AbstractView
DEFAULT_CONTENT_TYPE从类继承的字段 org.springframework.context.support.ApplicationObjectSupport
logger从接口继承的字段 org.springframework.web.servlet.View
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明booleancheckResource(Locale locale) 已过时。OverridesVelocityView.checkTemplate()to additionally check that both the layout template and the screen content template can be loaded.protected voiddoRender(org.apache.velocity.context.Context context, jakarta.servlet.http.HttpServletResponse response) 已过时。Overrides the normal rendering process in order to pre-process the Context, merging it with the screen template into a single value (identified by the value of screenContentKey).voidsetLayoutKey(String layoutKey) 已过时。Set the context key used to specify an alternate layout to be used instead of the default layout.voidsetLayoutUrl(String layoutUrl) 已过时。Set the layout template to use.voidsetScreenContentKey(String screenContentKey) 已过时。Set the name of the context key that will hold the content of the screen within the layout template.从类继承的方法 cn.aradin.spring.velocity.view.VelocityToolboxView
createVelocityContext, getToolboxConfigLocation, initTool, setToolboxConfigLocation从类继承的方法 cn.aradin.spring.velocity.view.VelocityView
autodetectVelocityEngine, createVelocityContext, exposeHelpers, exposeHelpers, exposeHelpers, exposeToolAttributes, getEncoding, getTemplate, getTemplate, getVelocityEngine, initApplicationContext, isCacheTemplate, mergeTemplate, renderMergedTemplateModel, setCacheTemplate, setDateToolAttribute, setEncoding, setNumberToolAttribute, setToolAttributes, setVelocityEngine从类继承的方法 org.springframework.web.servlet.view.AbstractTemplateView
applyContentType, renderMergedOutputModel, setAllowRequestOverride, setAllowSessionOverride, setExposeRequestAttributes, setExposeSessionAttributes, setExposeSpringMacroHelpers从类继承的方法 org.springframework.web.servlet.view.AbstractUrlBasedView
afterPropertiesSet, getUrl, isUrlRequired, setUrl, toString从类继承的方法 org.springframework.web.servlet.view.AbstractView
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, formatViewName, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponse从类继承的方法 org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext从类继承的方法 org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContext
-
字段详细资料
-
DEFAULT_LAYOUT_URL
已过时。The defaultlayout url.- 另请参阅:
-
DEFAULT_LAYOUT_KEY
已过时。The defaultlayout key.- 另请参阅:
-
DEFAULT_SCREEN_CONTENT_KEY
已过时。The defaultscreen content key.- 另请参阅:
-
-
构造器详细资料
-
VelocityLayoutView
public VelocityLayoutView()已过时。
-
-
方法详细资料
-
setLayoutUrl
已过时。Set the layout template to use. Default is"layout.vm".- 参数:
layoutUrl- the template location (relative to the template root directory)
-
setLayoutKey
已过时。Set the context key used to specify an alternate layout to be used instead of the default layout. Screen content templates can override the layout template that they wish to be wrapped with by setting this value in the template, for example:
#set($layout = "MyLayout.vm" )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 template
-
setScreenContentKey
已过时。Set the name of the context key that will hold the content of the screen within the layout template. This key must be present in the layout template for the current screen to be rendered.Default is
"screen_content": accessed in VTL as$screen_content.- 参数:
screenContentKey- the name of the screen content key to use
-
checkResource
已过时。OverridesVelocityView.checkTemplate()to additionally check that both the layout template and the screen content template can be loaded. Note that during rendering of the screen content, the layout template can be changed which may invalidate any early checking done here.- 覆盖:
checkResource在类中VelocityView- 抛出:
Exception
-
doRender
protected void doRender(org.apache.velocity.context.Context context, jakarta.servlet.http.HttpServletResponse response) throws Exception 已过时。Overrides the normal rendering process in order to pre-process the Context, merging it with the screen template into a single value (identified by the value of screenContentKey). The layout template is then merged with the modified Context in the super class.- 覆盖:
doRender在类中VelocityView- 参数:
context- the Velocity context to use for renderingresponse- servlet response (use this to get the OutputStream or Writer)- 抛出:
Exception- if thrown by Velocity- 另请参阅:
-
AbstractUrlBasedView.setUrl(java.lang.String)VelocityView.getTemplate()VelocityView.mergeTemplate(org.apache.velocity.Template, org.apache.velocity.context.Context, jakarta.servlet.http.HttpServletResponse)
-