org.springframework.web.servlet.view.tiles2

## Class TilesView

- 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.tiles2.TilesView

All Implemented Interfaces:
  Aware, BeanNameAware, InitializingBean, ApplicationContextAware, ServletContextAware, View

    public class TilesView
    extends AbstractUrlBasedView

`View` implementation that retrieves a Tiles definition. The "url" property is interpreted as name of a Tiles definition.

This class builds on Tiles2, which requires JSP 2.0. JSTL support is integrated out of the box due to JSTL's inclusion in JSP 2.0. Note: Spring 3.0 requires Tiles 2.1.2 or above.

Depends on a TilesContainer which must be available in the ServletContext. This container is typically set up via a `TilesConfigurer` bean definition in the application context.

Since:
  2.5
Author:
  Juergen Hoeller
See Also:
  `AbstractUrlBasedView.setUrl(java.lang.String)`, `TilesConfigurer`

### Field Summary

### Fields inherited from class org.springframework.web.servlet.view.AbstractView

`DEFAULT_CONTENT_TYPE`

### Fields inherited from class org.springframework.context.support.ApplicationObjectSupport

`logger`

### Fields inherited from interface org.springframework.web.servlet.View

`PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE`

### Constructor Summary

Constructors
Constructor and Description
`TilesView()`

### Method Summary

Methods
`boolean` `checkResource(Locale locale)` Check whether the underlying resource that the configured URL points to actually exists.
`protected void` `initServletContext(ServletContext sc)` Checks whether we need to explicitly expose the Servlet 2.4 request attributes by default.
`protected void` `renderMergedOutputModel(Map<String,Object> model, HttpServletRequest request, HttpServletResponse response)` Subclasses must implement this method to actually render the view.

### Methods inherited from class org.springframework.web.servlet.view.AbstractUrlBasedView

`afterPropertiesSet, getUrl, isUrlRequired, setUrl, toString`

### Methods inherited from class org.springframework.web.servlet.view.AbstractView

`addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponse`

### Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport

`getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, isContextRequired, setServletContext`

### Methods inherited from class org.springframework.context.support.ApplicationObjectSupport

`getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### TilesView

    public TilesView()

### Method Detail

#### initServletContext

    protected void initServletContext(ServletContext sc)

Checks whether we need to explicitly expose the Servlet 2.4 request attributes by default.

This will be done by default on Servlet containers up until 2.4, and skipped for Servlet 2.5 and above. Note that Servlet containers at 2.4 level and above should expose those attributes automatically! This feature exists for Servlet 2.3 containers and misbehaving 2.4 containers only.

Overrides:
  `initServletContext` in class `WebApplicationObjectSupport`
Parameters:
  `sc` - the ServletContext that this application object runs in (never `null`)

#### checkResource

    public boolean checkResource(Locale locale)
                          throws Exception

Description copied from class: `AbstractUrlBasedView`
Check whether the underlying resource that the configured URL points to actually exists.

Overrides:
  `checkResource` in class `AbstractUrlBasedView`
Parameters:
  `locale` - the desired Locale that we're looking for
Returns:
  `true` if the resource exists (or is assumed to exist); `false` if we know that it does not exist
Throws:
  `Exception` - if the resource exists but is invalid (e.g. could not be parsed)

#### renderMergedOutputModel

    protected void renderMergedOutputModel(Map<String,Object> model,
                               HttpServletRequest request,
                               HttpServletResponse response)
                                    throws Exception

Description copied from class: `AbstractView`
Subclasses must implement this method to actually render the view.

The first step will be preparing the request: In the JSP case, this would mean setting model objects as request attributes. The second step will be the actual rendering of the view, for example including the JSP via a RequestDispatcher.

Specified by:
  `renderMergedOutputModel` in class `AbstractView`
Parameters:
  `model` - combined output Map (never `null`), with dynamic values taking precedence over static attributes
  `request` - current HTTP request
  `response` - current HTTP response
Throws:
  `Exception` - if rendering failed