2828import org .apache .tiles .definition .DefinitionsFactory ;
2929import org .apache .tiles .definition .digester .DigesterDefinitionsReader ;
3030import org .apache .tiles .evaluator .el .ELAttributeEvaluator ;
31+ import org .apache .tiles .evaluator .impl .DirectAttributeEvaluator ;
3132import org .apache .tiles .factory .TilesContainerFactory ;
3233import org .apache .tiles .preparer .BasicPreparerFactory ;
3334import org .apache .tiles .servlet .context .ServletTilesApplicationContext ;
3940
4041import org .springframework .beans .factory .DisposableBean ;
4142import org .springframework .beans .factory .InitializingBean ;
43+ import org .springframework .util .ClassUtils ;
4244import org .springframework .util .CollectionUtils ;
4345import org .springframework .util .StringUtils ;
4446import org .springframework .web .context .ServletContextAware ;
4850 * <a href="http://tiles.apache.org">http://tiles.apache.org</a>
4951 * for more information about Tiles, which basically is a templating
5052 * mechanism for JSP-based web applications.
53+ *
5154 * <b>Note: Spring 3.0 requires Tiles 2.1.2 or above.</b>
55+ * Tiles EL support will be activated by default when running on JSP 2.1 or above.
5256 *
5357 * <p>The TilesConfigurer simply configures a TilesContainer using a set of files
5458 * containing definitions, to be accessed by {@link TilesView} instances. This is a
8286 */
8387public class TilesConfigurer implements ServletContextAware , InitializingBean , DisposableBean {
8488
89+ private static final boolean jsp21Present = ClassUtils .isPresent (
90+ "javax.servlet.jsp.JspApplicationContext" , TilesConfigurer .class .getClassLoader ());
91+
8592 protected final Log logger = LogFactory .getLog (getClass ());
8693
8794 private final Properties tilesPropertyMap = new Properties ();
@@ -94,12 +101,12 @@ public TilesConfigurer() {
94101 WildcardServletTilesApplicationContextFactory .class .getName ());
95102 this .tilesPropertyMap .put (TilesContainerFactory .PREPARER_FACTORY_INIT_PARAM ,
96103 BasicPreparerFactory .class .getName ());
104+ this .tilesPropertyMap .put (TilesContainerFactory .CONTAINER_FACTORY_MUTABLE_INIT_PARAM ,
105+ Boolean .toString (false ));
97106 this .tilesPropertyMap .put (DefinitionsFactory .LOCALE_RESOLVER_IMPL_PROPERTY ,
98107 SpringLocaleResolver .class .getName ());
99108 this .tilesPropertyMap .put (TilesContainerFactory .ATTRIBUTE_EVALUATOR_INIT_PARAM ,
100- ELAttributeEvaluator .class .getName ());
101- this .tilesPropertyMap .put (TilesContainerFactory .CONTAINER_FACTORY_MUTABLE_INIT_PARAM ,
102- Boolean .toString (false ));
109+ jsp21Present ? ELAttributeEvaluator .class .getName () : DirectAttributeEvaluator .class .getName ());
103110 }
104111
105112
0 commit comments