• com.opensymphony.module.sitemesh.filter.PageFilter 装饰页面


    1、web.xml中配置:

    <filter>
            <filter-name>sitemeshFilter</filter-name>
            <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>sitemeshFilter</filter-name>
            <url-pattern>/a/*</url-pattern>
        </filter-mapping>
        <filter-mapping>
            <filter-name>sitemeshFilter</filter-name>
            <url-pattern>/f/*</url-pattern>
        </filter-mapping>

    2、并列web.xml新建文件decorators.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <decorators defaultdir="/WEB-INF/views">
        
        <!-- 默认装饰页面, 在需要装饰的页面增加<meta name="decorator" content="default"/> -->
        <decorator name="blank" page="layouts/blank.jsp" />
        <decorator name="default" page="layouts/default.jsp" />
        
    </decorators>

    3、在需要装饰的页面增加<meta name="decorator" content="default"/>

    相当于占位符;

     4、default.jsp内容:

    <%@ page contentType="text/html;charset=UTF-8"%>
    <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
    <%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>
    <!DOCTYPE html>
    <html style="overflow-x:auto;overflow-y:auto;">
    <head>
    	<title><sitemesh:title/></title>
    	<%@include file="/WEB-INF/views/include/head.jsp" %>		
    	<!-- Baidu tongji analytics --><script>var _hmt=_hmt||[];(function(){var hm=document.createElement("script");hm.src="//hm.baidu.com/hm.js?82116c626a8d504a5c0675073362ef6f";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm,s);})();</script>
    	<sitemesh:head/>
    </head>
    <body>
    	<sitemesh:body/>
    	  <script type="text/javascript">//<!-- 无框架时,左上角显示菜单图标按钮。
    		if(!(self.frameElement && self.frameElement.tagName=="IFRAME")){
    			//$("body").prepend("<i id="btnMenu" class="icon-th-list" style="cursor:pointer;float:right;margin:10px;"></i><div id="menuContent"></div>");
    			//$("#btnMenu").click(function(){
    				//top.$.jBox('get:${ctx}/sys/menu/treeselect;JSESSIONID=<shiro:principal property="sessionid"/>', {title:'选择菜单', buttons:{'关闭':true}, 300, height: 350, top:10});
    				//if ($("#menuContent").html()==""){$.get("${ctx}/sys/menu/treeselect", function(data){$("#menuContent").html(data);});}else{$("#menuContent").toggle(100);}
    			//});
    		}//-->
    	</script>  
    </body>
    </html>
    
  • 相关阅读:
    Java ,python面向对象的继承及其区别
    谈谈我理解的敏捷开发
    Centos7 升级python3,解决升级后不兼容问题
    Django + Uwsgi + Nginx 的生产环境部署
    理解Python协程:从yield/send到yield from再到async/await
    【转】Python 数据库连接池
    为何GET只发一次TCP连接,POST发两次TCP连接
    Python简单密码加密程序,加盐(salt)md5
    spring学习(三) ———— spring事务操作
    spring学习(二) ———— AOP之AspectJ框架的使用
  • 原文地址:https://www.cnblogs.com/hoge/p/5262006.html
Copyright © 2020-2023  润新知