简体   繁体   中英

JSP Expression Language not work in Apache Tiles

Hello i try to migrate my Spring MVC application to use Apache Tiles 3.0.5 as template engine. But when i access my web application, my EL's value not work. My value comes from ModelMap model .

...
model.addAttribute("billings", billingService.getAllBillings());
...

Here is my spring configuration.

...
<context:component-scan base-package="com.fanjavaid"></context:component-scan>
    <mvc:annotation-driven></mvc:annotation-driven>

    <mvc:resources location="/resources/" mapping="/resources/**"></mvc:resources>
    <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
        <property name="definitions">
            <list>
                <value>/WEB-INF/tiles.xml</value>
                <value>/WEB-INF/views/**/views.xml</value>
            </list>
        </property>
    </bean>
    <bean id="tilesViewConfigurer" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass">
            <value>org.springframework.web.servlet.view.tiles3.TilesView</value>
        </property>
        <property name="order" value="0"></property>
    </bean>
...

And below is my tiles definition configuration.

...
<tiles-definitions>
    <definition name="indexpage" extends="base.definition">
        <put-attribute name="title" value="Index"></put-attribute>
        <put-attribute name="header" value="/WEB-INF/views/includes/header.jsp"></put-attribute>
        <put-attribute name="body" value="/WEB-INF/views/index.jsp"></put-attribute>
    </definition>
    <definition name="listpage" extends="base.definition">
        <put-attribute name="title" value="List"></put-attribute>
        <put-attribute name="header" value="/WEB-INF/views/includes/header.jsp"></put-attribute>
        <put-attribute name="body" value="/WEB-INF/views/list.jsp"></put-attribute>
    </definition>
    <definition name="showpage" extends="base.definition">
        <put-attribute name="title" value="Show"></put-attribute>
        <put-attribute name="header" value="/WEB-INF/views/includes/header.jsp"></put-attribute>
        <put-attribute name="body" value="/WEB-INF/views/show.jsp"></put-attribute>
    </definition>
</tiles-definitions>    
...

I already try to put isElIgnored but it not works. May be i miss some configurations?

Thank you.

In my case, I was having a generated web.xml as well as the AppInitizlier that extends AbstractAnnotationConfigDispatcherServletInitializer (to replace web.xml). When I removed the web.xml, the el expressions began to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM