是否有可能將sitemesh和tiles 2.1與spring mvc集成? 我想用瓷磚合成佈局,然後用sitemesh裝飾。sitemesh和瓷磚2.1與spring的集成MVC
我正在使用那樣的瓷磚。
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/layouts/layouts.xml</value>
<value>/WEB-INF/views.xml</value>
<value>/WEB-INF/hotels/views.xml</value>
<value>/WEB-INF/hotels/booking/views.xml</value>
<value>/WEB-INF/cliente/views.xml</value>
</list>
</property>
</bean>
然後我在xml中配置sitemesh。
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
然後我加裝飾
<?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/styles">
<decorator page="application/themeManager/theme.jsp" name="theme">
<pattern>/spring/hotels/index</pattern>
</decorator>
</decorators>
但是,這並不什麼都不做,我認爲瓷磚避免SiteMesh的處理頁面,如何做到這一點?
這個sitemesh.xml我只是用自帶的例子
<sitemesh>
<property name="decorators-file" value="/WEB-INF/decorators.xml"/>
<excludes file="${decorators-file}"/>
<!--<excludes file="/WEB-INF/decorators.xml"/>-->
<page-parsers>
<parser content-type="text/html" class="com.opensymphony.module.sitemesh.parser.HTMLPageParser" />
</page-parsers>
<decorator-mappers>
<mapper class="com.opensymphony.module.sitemesh.mapper.PageDecoratorMapper">
<param name="property.1" value="meta.decorator" />
<param name="property.2" value="decorator" />
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.FrameSetDecoratorMapper">
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.AgentDecoratorMapper">
<param name="match.MSIE" value="ie" />
<param name="match.Firefox" value="mozilla" />
<param name="match.Opera" value="opera" />
<param name="match.Lynx" value="lynx" />
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.PrintableDecoratorMapper">
<param name="decorator" value="printable" />
<param name="parameter.name" value="printable" />
<param name="parameter.value" value="true" />
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.RobotDecoratorMapper">
<param name="decorator" value="robot" />
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.ParameterDecoratorMapper">
<param name="decorator.parameter" value="decorator" />
<param name="parameter.name" value="confirm" />
<param name="parameter.value" value="true" />
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.FileDecoratorMapper">
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
<param name="config" value="${decorators-file}" />
</mapper>
</decorator-mappers>
</sitemesh>
你的sitemesh.xml文件是什麼樣的? – skaffman 2010-05-17 16:52:20
就像默認配置一樣,我注意到如果我將配置添加到不受Spring管理的路徑中,它也可以工作,如果我使用org.springframework.web.servlet.view.InternalResourceViewResolver它作品 – atomsfat 2010-05-17 18:49:08