Browse Source

Remove obsolete Tiles documentation from reference manual

Tiles support was officially removed in conjunction with gh-27423.

Closes gh-29852
pull/29868/head
Sam Brannen 3 years ago
parent
commit
047f660572
  1. 132
      framework-docs/src/docs/asciidoc/web/webmvc-view.adoc
  2. 6
      framework-docs/src/docs/asciidoc/web/webmvc.adoc

132
framework-docs/src/docs/asciidoc/web/webmvc-view.adoc

@ -1649,138 +1649,6 @@ is the default type. @@ -1649,138 +1649,6 @@ is the default type.
[[mvc-view-tiles]]
== Tiles
You can integrate Tiles - just as any other view technology - in web
applications that use Spring. This section describes, in a broad way, how to do so.
NOTE: This section focuses on Spring's support for Tiles version 3 in the
`org.springframework.web.servlet.view.tiles3` package.
[[mvc-view-tiles-dependencies]]
=== Dependencies
To be able to use Tiles, you have to add a dependency on Tiles version 3.0.1 or higher
and https://tiles.apache.org/framework/dependency-management.html[its transitive dependencies]
to your project.
[[mvc-view-tiles-integrate]]
=== Configuration
To be able to use Tiles, you have to configure it by using files that contain definitions
(for basic information on definitions and other Tiles concepts, see
https://tiles.apache.org[]). In Spring, this is done by using the `TilesConfigurer`.
The following example `ApplicationContext` configuration shows how to do so:
[source,xml,indent=0,subs="verbatim,quotes"]
----
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/defs/general.xml</value>
<value>/WEB-INF/defs/widgets.xml</value>
<value>/WEB-INF/defs/administrator.xml</value>
<value>/WEB-INF/defs/customer.xml</value>
<value>/WEB-INF/defs/templates.xml</value>
</list>
</property>
</bean>
----
The preceding example defines five files that contain definitions. The files are all
located in the `WEB-INF/defs` directory. At initialization of the `WebApplicationContext`,
the files are loaded, and the definitions factory are initialized. After that has
been done, the Tiles included in the definition files can be used as views within your
Spring web application. To be able to use the views, you have to have a `ViewResolver`
as with any other view technology in Spring: typically a convenient `TilesViewResolver`.
You can specify locale-specific Tiles definitions by adding an underscore and then
the locale, as the following example shows:
[source,xml,indent=0,subs="verbatim,quotes"]
----
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/defs/tiles.xml</value>
<value>/WEB-INF/defs/tiles_fr_FR.xml</value>
</list>
</property>
</bean>
----
With the preceding configuration, `tiles_fr_FR.xml` is used for requests with the `fr_FR` locale,
and `tiles.xml` is used by default.
NOTE: Since underscores are used to indicate locales, we recommended not using
them otherwise in the file names for Tiles definitions.
[[mvc-view-tiles-url]]
==== `UrlBasedViewResolver`
The `UrlBasedViewResolver` instantiates the given `viewClass` for each view it has to
resolve. The following bean defines a `UrlBasedViewResolver`:
[source,xml,indent=0,subs="verbatim,quotes"]
----
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/>
</bean>
----
[[mvc-view-tiles-preparer]]
==== `SimpleSpringPreparerFactory` and `SpringBeanPreparerFactory`
As an advanced feature, Spring also supports two special Tiles `PreparerFactory`
implementations. See the Tiles documentation for details on how to use
`ViewPreparer` references in your Tiles definition files.
You can specify `SimpleSpringPreparerFactory` to autowire `ViewPreparer` instances based on
specified preparer classes, applying Spring's container callbacks as well as applying
configured Spring BeanPostProcessors. If Spring's context-wide annotation configuration has
been activated, annotations in `ViewPreparer` classes are automatically detected and
applied. Note that this expects preparer classes in the Tiles definition files, as
the default `PreparerFactory` does.
You can specify `SpringBeanPreparerFactory` to operate on specified preparer names (instead
of classes), obtaining the corresponding Spring bean from the DispatcherServlet's
application context. The full bean creation process is in the control of the Spring
application context in this case, allowing for the use of explicit dependency injection
configuration, scoped beans, and so on. Note that you need to define one Spring bean definition
for each preparer name (as used in your Tiles definitions). The following example shows
how to define a `SpringBeanPreparerFactory` property on a `TilesConfigurer` bean:
[source,xml,indent=0,subs="verbatim,quotes"]
----
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/defs/general.xml</value>
<value>/WEB-INF/defs/widgets.xml</value>
<value>/WEB-INF/defs/administrator.xml</value>
<value>/WEB-INF/defs/customer.xml</value>
<value>/WEB-INF/defs/templates.xml</value>
</list>
</property>
<!-- resolving preparer names as Spring bean definition names -->
<property name="preparerFactoryClass"
value="org.springframework.web.servlet.view.tiles3.SpringBeanPreparerFactory"/>
</bean>
----
[[mvc-view-feeds]]
== RSS and Atom

6
framework-docs/src/docs/asciidoc/web/webmvc.adoc

@ -802,8 +802,8 @@ The following table provides more details on the `ViewResolver` hierarchy: @@ -802,8 +802,8 @@ The following table provides more details on the `ViewResolver` hierarchy:
| `InternalResourceViewResolver`
| Convenient subclass of `UrlBasedViewResolver` that supports `InternalResourceView` (in
effect, Servlets and JSPs) and subclasses such as `JstlView` and `TilesView`. You can
specify the view class for all views generated by this resolver by using `setViewClass(..)`.
effect, Servlets and JSPs) and subclasses such as `JstlView`. You can specify the view
class for all views generated by this resolver by using `setViewClass(..)`.
See the {api-spring-framework}/web/reactive/result/view/UrlBasedViewResolver.html[`UrlBasedViewResolver`]
javadoc for details.
@ -5888,7 +5888,7 @@ The following example shows how to achieve the same configuration in XML: @@ -5888,7 +5888,7 @@ The following example shows how to achieve the same configuration in XML:
</mvc:view-resolvers>
----
Note, however, that FreeMarker, Tiles, Groovy Markup, and script templates also require
Note, however, that FreeMarker, Groovy Markup, and script templates also require
configuration of the underlying view technology.
The MVC namespace provides dedicated elements. The following example works with FreeMarker:

Loading…
Cancel
Save