Following the previous example project Http://www.cnblogs.com/EasonJim/p/7083165.html, using the Configdecoratormapper Mapper, the page under the specified directory is the same as the template page.
On the use, just set two places, no configuration on the basic page.
1, Decorators.xml
<?XML version= "1.0" encoding= "UTF-8"?><DecoratorsDefaultDir= "/decorators"> <Decoratorname= "Basic-theme"page= "basic-theme.jsp"> <pattern>/data/*</pattern> </Decorator></Decorators>
2, Sitemesh.xml
<Sitemesh> <property name= "Decorators-file" value= "/web-inf/decorators.xml"/> <excludes file= "${decorators-file} "/> <page-parsers> <ParserContent-type= "text/html"class= "Com.opensymphony.module.sitemesh.parser.HTMLPageParser" /> </page-parsers> <decorator-mappers> <Mapperclass= "Com.opensymphony.module.sitemesh.mapper.PageDecoratorMapper"> <paramname= "Property.1"value= "Meta.decorator" /> <paramname= "property.2"value= "Decorator" /> </Mapper> <Mapperclass= "Com.opensymphony.module.sitemesh.mapper.FrameSetDecoratorMapper"/> <Mapperclass= "Com.opensymphony.module.sitemesh.mapper.PrintableDecoratorMapper"> <paramname= "Decorator"value= "Printable" /> <paramname= "Parameter.name"value= "Printable" /> <paramname= "Parameter.value"value= "true" /> </Mapper> <Mapperclass= "Com.opensymphony.module.sitemesh.mapper.FileDecoratorMapper"/> <mapper class= "Com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper" > <param name= "config "Value=" ${decorators-file} "/> </mapper> </decorator-mappers></Sitemesh>
Reference:
Https://web.archive.org/web/20071008163555fw_/http://www.opensymphony.com/sitemesh/api/com/opensymphony/module /sitemesh/mapper/configdecoratormapper.html
Usage of the Configdecoratormapper mapper for Sitemesh2-sitemesh.xml