sitemesh3.0 自定义标签
来源:互联网 发布:网络赌托算什么犯罪 编辑:程序博客网 时间:2024/06/05 05:48
对于sitemesh3,官方只给出了<title><head><body> 三个标签,但是对于一些特殊的需求是远远不能满足的,好了,不废话了,进入正题:
本文章是基于java类来配置的,先建好sitemesh的配置类SiteMeshFilter ,如下:
public class SiteMeshFilter extends ConfigurableSiteMeshFilter { @Override protected void applyCustomConfiguration(SiteMeshFilterBuilder builder) { //customer decorator builder.addTagRuleBundle(new CustomTagRuleBundle()); }}接下来是CustomTagRuleBundle,如下:
public class CustomTagRuleBundle implements TagRuleBundle { @Override public void install(State defaultState, ContentProperty contentProperty, SiteMeshContext siteMeshContext) { defaultState.addRule("myfooter", new ExportTagToContentRule(siteMeshContext, contentProperty.getChild("myfooter"), false)); } @Override public void cleanUp(State defaultState, ContentProperty contentProperty, SiteMeshContext siteMeshContext) { }}到此为止,就可以了接下里就是解释,
“myfooter” 是我自定义的标签名字,如果需要多个,则只需要在install里面多添加一条addRule;
下面是母页面的引用:
<body><sitemesh:write property='body'/><div class="footer"> <p align="center">© 2016 仙飞 版权所有 </p></div><sitemesh:write property='myfooter'/></body>只贴了body部分,其他的也不重要;
下面是子页面的引用:
<body><myfooter> 自定义页脚</myfooter></body>
1 0
- sitemesh3.0 自定义标签
- sitemesh3.0配置
- SiteMesh3.0的下载,简介与使用
- SiteMesh3.0的下载,简介与使用
- thinkphp3.0 自定义标签
- JSP2.0自定义标签
- JSP2.0自定义标签
- sitemesh3.0的配置以及在静态html中的使用
- sitemesh3配置
- SiteMesh3配置
- sitemesh3 配置文件
- sitemesh3配置
- SiteMesh3配置
- sitemesh3配置
- SiteMesh3入门教程
- 自定义标签
- 自定义标签
- 自定义标签
- 【c/c++】内存地址
- android的WiFi调试
- iOS 开发:绘制像素到屏幕
- 六款 c http 服务器
- Android源码编译整理总结
- sitemesh3.0 自定义标签
- 用ip_gre做公网IP端口映射,类似于DNAT
- 砸金蛋jsp效果--没有后台功能
- 如何使用Valgrind memcheck工具进行C/C++的内存泄漏检测
- 农村电子商务专家学者以及来自全国各地的淘宝村代表将齐聚一堂
- windows server 2012 计划任务 系统找不到指定文件
- 使用ActionBar实现Tab导航
- JAVA工程师成神之路--基础篇(二)JAVA内存模型
- android Launcher Demo小结