简体   繁体   中英

Spring MVC Tiles 3 and ajax integration

How to ajax call from the body part, where I have used tiles view in spring MVC. I didn't find any good example, if any body can help. So far I am able configure and run the tilesview.

<beans:bean id="tilesConfigurer"
    class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
    <beans:property name="definitions">
        <beans:list>
            <beans:value>/WEB-INF/tiles.xml</beans:value>
            <beans:value>/WEB-INF/views/**/views.xml</beans:value>
        </beans:list>
    </beans:property>
</beans:bean>


<beans:bean id="tilesViewResolver"
    class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <beans:property name="viewClass">
        <beans:value>
            org.springframework.web.servlet.view.tiles3.TilesView
        </beans:value>
    </beans:property>
    <beans:property name="order" value="0"/>
</beans:bean>

Now I want to send ajax request but no idea how to do it.

Tiles works on the server side, whereas Ajax calls are issued from the client (browser) side. There shouldn't be any interference between the two, as they live in separate universes.

The Ajax calls shouldn't target URLs that are mapped to Tiles definitions ; rather, you should develop new endpoints that directly return JSON, XML or whatever your Ajax call expects.

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