PDA

View Full Version : Integratin Tiles and Spring - page not rendering



tnist
Sep 8th, 2004, 10:30 AM
Hello,

I am trying to integrate Tiles with Spring. I have created a simple baselayout that is used by tiles and that the other views will extend. I believe that I added the correct information to the supporting xml configuration files.

I have added the "viewResolver" as follows:


<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResou rceViewResolver">
<property name="requestContextAttribute"><value>requestContext</value></property>
<property name="viewClass"><value>org.springframework.web.servlet.view.tiles.TilesJs tlView</value></property>
</bean>


I looking at the log file, it appears as though tiles is bein initialized correctly. However when every I hit the site, I get redirected to the appropriate "baselayout", but none of the <tiles:> tags are processed, they just show up in the rendered html. Any ideas what I am missing?

I am sure I must be missing something fairly obvious, but I do not see it.

Thanks in advance for your assistance.

Regards,
Todd

m_kehle
Sep 9th, 2004, 01:58 AM
Hi Todd,
here can you see my working configuraton for tiles in spring, may you find the missing point in your config:

webapp-servlet.xml:



...
<!-- Tiles -->
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles.TilesCo nfigurer">
<property name="factoryClass">
<value>org.apache.struts.tiles.xmlDefinition.I18nFactoryS et</value>
</property>
<property name="definitions">
<list>
<value>/WEB-INF/tiles-config.xml</value>
</list>
</property>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResou rceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.tiles.TilesJs tlView</value>
</property>
</bean>
...



web.xml:



....
<taglib>
<taglib-uri>tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
...


In your jsp you have to include the tag lib:


<%@ taglib prefix="tiles" uri="http&#58;//jakarta.apache.org/struts/tags-tiles" %>

Hope that helps...
markus

tnist
Sep 9th, 2004, 05:44 AM
Markus,

Thanks for the input, I found the error, a silly one at that. I have a .jsp that is included in my pages that define all the taglibs to be used, and I neglected to add the reference to the tiles tag lib.

Thanks again for the help.

Regards,
Todd