public class

TilesView

extends AbstractUrlBasedView
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

Class Overview

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.

Summary

[Expand]
Inherited Constants
From class org.springframework.web.servlet.view.AbstractView
[Expand]
Inherited Fields
From class org.springframework.context.support.ApplicationObjectSupport
From interface org.springframework.web.servlet.View
Public Constructors
TilesView()
Public Methods
boolean checkResource(Locale locale)
Check whether the underlying resource that the configured URL points to actually exists.
Protected Methods
void initServletContext(ServletContext sc)
Checks whether we need to explicitly expose the Servlet 2.4 request attributes by default.
void renderMergedOutputModel(Map<StringObject> model, HttpServletRequest request, HttpServletResponse response)
Subclasses must implement this method to actually render the view.
[Expand]
Inherited Methods
From class org.springframework.web.servlet.view.AbstractUrlBasedView
From class org.springframework.web.servlet.view.AbstractView
From class org.springframework.web.context.support.WebApplicationObjectSupport
From class org.springframework.context.support.ApplicationObjectSupport
From class java.lang.Object
From interface org.springframework.beans.factory.BeanNameAware
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.context.ApplicationContextAware
From interface org.springframework.web.context.ServletContextAware
From interface org.springframework.web.servlet.View

Public Constructors

public TilesView ()

Public Methods

public boolean checkResource (Locale locale)

Check whether the underlying resource that the configured URL points to actually exists.

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

Protected Methods

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.

Parameters
sc the ServletContext that this application object runs in (never null)

protected void renderMergedOutputModel (Map<StringObject> model, HttpServletRequest request, HttpServletResponse response)

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.

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