Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » web » servlet » view » tiles2 » [javadoc | source]
org.springframework.web.servlet.view.tiles2
public class: TilesConfigurer [javadoc | source]
java.lang.Object
   org.springframework.web.servlet.view.tiles2.TilesConfigurer

All Implemented Interfaces:
    DisposableBean, InitializingBean, ServletContextAware

Helper class to configure Tiles2 for the Spring Framework. See http://tiles.apache.org for more information about Tiles, which basically is a templating mechanism for JSP-based web applications.

The TilesConfigurer simply configures a TilesContainer using a set of files containing definitions, to be accessed by TilesView instances.

TilesViews can be managed by any org.springframework.web.servlet.ViewResolver . For simple convention-based view resolution, consider using org.springframework.web.servlet.view.UrlBasedViewResolver with the "viewClass" property set to "org.springframework.web.servlet.view.tiles2.TilesView".

A typical TilesConfigurer bean definition looks as follows:

<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.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 values in the list are the actual files containing the definitions.
Field Summary
protected final  Log logger     
Constructor:
 public TilesConfigurer() 
Method from org.springframework.web.servlet.view.tiles2.TilesConfigurer Summary:
afterPropertiesSet,   createTilesContainer,   destroy,   setDefinitions,   setDefinitionsFactoryClass,   setPreparerFactoryClass,   setServletContext,   setTilesProperties,   setUseMutableTilesContainer,   setValidateDefinitions
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.web.servlet.view.tiles2.TilesConfigurer Detail:
 public  void afterPropertiesSet() throws TilesException 
    Creates and exposes a TilesContainer for this web application.
 protected TilesContainer createTilesContainer(ServletContext context) throws TilesException 
    Create a TilesContainer for this web application.
 public  void destroy() throws TilesException 
    Removes the TilesContainer from this web application.
 public  void setDefinitions(String[] definitions) 
    Set the Tiles definitions, i.e. the list of files containing the definitions. Default is "/WEB-INF/tiles.xml".
 public  void setDefinitionsFactoryClass(Class definitionsFactoryClass) 
 public  void setPreparerFactoryClass(Class preparerFactoryClass) 
    Set the org.apache.tiles.preparer.PreparerFactory implementation to use. Default is org.apache.tiles.preparer.BasicPreparerFactory , creating shared instances for specified preparer classes.

    Specify SimpleSpringPreparerFactory to autowire org.apache.tiles.preparer.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-config has been activated, annotations in ViewPreparer classes will be automatically detected and applied.

    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 will be in the control of the Spring application context in this case, allowing for the use of scoped beans etc. Note that you need to define one Spring bean definition per preparer name (as used in your Tiles definitions).

 public  void setServletContext(ServletContext servletContext) 
 public  void setTilesProperties(Properties tilesProperties) 
    Set Tiles properties (equivalent to the ServletContext init-params in the Tiles documentation), overriding the default settings.
 public  void setUseMutableTilesContainer(boolean useMutableTilesContainer) 
    Set whether to use a MutableTilesContainer for this application. Default is "false".
 public  void setValidateDefinitions(boolean validateDefinitions) 
    Set whether to validate the Tiles XML definitions. Default is "true".