类 VelocityLayoutView

java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.view.AbstractView
org.springframework.web.servlet.view.AbstractUrlBasedView
org.springframework.web.servlet.view.AbstractTemplateView
所有已实现的接口:
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

@Deprecated public class VelocityLayoutView extends VelocityToolboxView
已过时。
as of Spring 4.3, in favor of FreeMarker
VelocityLayoutView emulates the functionality offered by Velocity's VelocityLayoutServlet to ease page composition from different templates.

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 default layout key.
    static final String
    已过时。
    The default layout url.
    static final String
    已过时。
    The default screen 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
  • 构造器概要

    构造器
    构造器
    说明
    已过时。
     
  • 方法概要

    修饰符和类型
    方法
    说明
    boolean
    已过时。
    Overrides VelocityView.checkTemplate() to additionally check that both the layout template and the screen content template can be loaded.
    protected void
    doRender(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).
    void
    setLayoutKey(String layoutKey)
    已过时。
    Set the context key used to specify an alternate layout to be used instead of the default layout.
    void
    setLayoutUrl(String layoutUrl)
    已过时。
    Set the layout template to use.
    void
    setScreenContentKey(String screenContentKey)
    已过时。
    Set the name of the context key that will hold the content of the screen within the layout template.

    从类继承的方法 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

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 字段详细资料

  • 构造器详细资料

    • VelocityLayoutView

      public VelocityLayoutView()
      已过时。
  • 方法详细资料

    • setLayoutUrl

      public void setLayoutUrl(String layoutUrl)
      已过时。
      Set the layout template to use. Default is "layout.vm".
      参数:
      layoutUrl - the template location (relative to the template root directory)
    • setLayoutKey

      public void setLayoutKey(String layoutKey)
      已过时。
      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

      public void setScreenContentKey(String screenContentKey)
      已过时。
      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

      public boolean checkResource(Locale locale) throws Exception
      已过时。
      Overrides VelocityView.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 rendering
      response - servlet response (use this to get the OutputStream or Writer)
      抛出:
      Exception - if thrown by Velocity
      另请参阅: