• 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>
    
  • 相关阅读:
    List<Object> 查询解析优化
    hibernate 中 query.list()的优化
    移动端屏幕宽度自适应原理及实现
    js获取用户当前地理位置(省、市、经纬度)
    mescroll.js简单的上拉加载、下拉刷新插件,带完整注释
    Web前端性能优化总结——如何提高网页加载速度
    浏览器渲染页面的原理及流程
    优酷1080p的kux格式文件怎么转换为MP4格式?
    js处理文章详情页点击量统计
    plupload上传视频插件jQuery+php
  • 原文地址:https://www.cnblogs.com/hoge/p/5262006.html
Copyright © 2020-2023  润新知