<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    數據加載中……
    sitemesh 簡單入門 之二
    2008年4月16日  Edited By DingDangXiaoMa 
     (1)printable 裝飾及 page 用法。
    當要打印頁面內容時,不想要一些邊邊框框。只關注想要的內容,設置為printable decorators 即可。
    sitemesh 設置方法如下:
    setemesh.xml
    <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>
    上面代碼為設置  打印的屬性及參數。?printable=true鏈接到打印模式上。
    decorators.xml
     <decorator name="printable" page="printable.jsp"/>
    功能:將name="printable" 的裝飾映射到printable.jsp上。
    printable.jsp
    <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
    <html>
        
    <head>
            
    <title><decorator:title default="NO Title" /></title>
            
    <decorator:head />
        
    </head>
        
    <body>
            
    <h1><decorator:title  default="No Title"/></h1>
            
    <p align="right"><i>(printable version)</i></p>
            
    <decorator:body />
        
    </body>
    </html>
    這是參照官方上的例子的printable.jsp.注意。當鏈接指向時,沒有標題時,顯示No Title .當沒有body部分時,則會出現null point error(我出現了這個錯誤,不知道是不是我機子的問題)
    按照上述配置后:當訪問:http://localhost/sitemesh/index.jsp?printable=true 時,就只能顯示index.jsp未被修飾的數據。
    再進行修改就是在頁面上加一個超級鏈接到些頁面打印狀態。
    在decorators/main.jsp中加入以下代碼;
            <decorator:usePage id="p" />
            
    <%
                HttpServletRequest req 
    = p.getRequest();
                StringBuffer printUrl 
    = new StringBuffer();
                printUrl.append( req.getRequestURI() );
                printUrl.append(
    "?printable=true");
                
    if (request.getQueryString()!=null) {
                    printUrl.append(
    '&');
                    printUrl.append(request.getQueryString());
                }
            
    %>
            
    <p align="right"><a href="<%= printUrl %>">printable version</a> ]</p>
    這樣就在每個頁面都添加上了,打印式的超級鏈接。 <decorator:usePage id="p" /> 是獲得了頁面的page對象。
    (2)page:applyDecorator 用法:把某一個頁面進行某種樣式的映射。<page:applyDecorator page="*.jsp" name="*" />
    把*.jsp映射到decorators.xml 中定義的* 裝飾上。
    例子:
    <page:applyDecorator name="panel" page="/date.jsp" >


    posted on 2008-04-16 18:07 叮當小馬 閱讀(337) 評論(0)  編輯  收藏 所屬分類: OpenSymphony


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 日韩电影免费在线观看网址| 毛片免费观看的视频在线| 日本xxxx色视频在线观看免费| 亚洲免费视频播放| 911精品国产亚洲日本美国韩国| 亚洲AV无码XXX麻豆艾秋| 日韩免费观看视频| 中文字幕在线观看亚洲| 精品国产污污免费网站aⅴ| 亚洲av永久无码精品天堂久久| 女人隐私秘视频黄www免费| 成人免费视频试看120秒| 狼人大香伊蕉国产WWW亚洲| 亚洲国产av无码精品| 中文字幕的电影免费网站| 永久免费视频v片www| 香蕉视频免费在线| 国产AV无码专区亚洲AV漫画| a级片免费观看视频| 亚洲日韩乱码中文无码蜜桃臀| 香蕉免费在线视频| 亚洲精品国产肉丝袜久久| 一级女人18毛片免费| WWW亚洲色大成网络.COM| 在线观看亚洲成人| 日本视频一区在线观看免费| 国产亚洲一区二区三区在线| 91在线手机精品免费观看| 亚洲最大激情中文字幕| 中文字幕成人免费视频| 亚洲成AV人在线观看天堂无码| 黄色大片免费网站| 久久久久久久久亚洲| 女人让男人免费桶爽30分钟| 一本岛v免费不卡一二三区| 亚洲三级电影网址| 免费国产高清视频| 久久亚洲中文字幕无码| 亚洲AV无一区二区三区久久| 精品熟女少妇AV免费观看| eeuss影院ss奇兵免费com|