自定义facelet-taglib



--------------------------\web\WEB-INF\yellowcp\custom.taglib.xml----------------------------------------------

<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC
        "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
        "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
<facelet-taglib>
    <namespace>http://reports.yellowbook.com/ns/cp</namespace>
    <!--side panel with account details-->
    <tag>
        <tag-name>accountPanel</tag-name>
        <source>accountPanel.xhtml</source>
    </tag>
    <tag>
        <tag-name>dc</tag-name>
        <source>dataContainer.xhtml</source>
    </tag>
    <tag>
        <tag-name>df</tag-name>
        <source>dateFilter.xhtml</source>
    </tag>
    <tag>
        <tag-name>bh</tag-name>
        <source>bodyHeader.xhtml</source>
    </tag>
    ...
</facelet-taglib>


------------------------------------- .xhtml-----------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:yb="http://reports.yellowbook.com/ns/wr"
      xmlns:cp="http://reports.yellowbook.com/ns/cp">

<head></head>

<body>
<ui:composition template="../include/templates/printTemplate.xhtml">
    <ui:define name="pageTitle"><!--<h:outputText value="#{msg['dailyactivity.title']}"/>-->DMS Campaign Activity</ui:define>
    <ui:define name="customScript">
        <script type="text/javascript" src="../dwr/interface/jDailyActivity.js"></script>
        <script type="text/javascript" src="../js/dmsDailyActivityPrint.js"></script>
    </ui:define>
    <ui:define name="customStyle">
        <style type="text/css">
            ...
        </style>
    </ui:define>

    <ui:define name="content">

        <div id="mainBody">

            <cp:bh bhPageTitle="#{msg['dailyactivity.print.title']}"/>             
            <div class="dataContainer">
                <div class="table1 initial">
                    <div id="tDailyActivity"></div>
                </div>
            </div>
        </div>
        <div class="clear"></div>

        <script type="text/javascript">
            display();
        </script>
    </ui:define>
</ui:composition>

</body>
</html>

-----------------------------------bodyheader.xhtml-------------------------------------

<ui:component
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:c="http://java.sun.com/jstl/core">
    <div id="mainBodyHeader">
        <c:if test="#{!empty bhPageTitle}">
            <h2 id="mainBodyTitle"><h:outputText value="#{bhPageTitle}"/></h2>
        </c:if>

        <span id="mediaBuySelectContainer">
            <h:outputText xmlns:h="http://java.sun.com/jsf/html" value="#{bhSelectLabel}"/> <select
                id="ybMediaBuySelector" class="ybSelector"/>
        </span>

        <!-- hide the selector until needed -->
        <script type="text/javascript">
            $("mediaBuySelectContainer").hide();
        </script>

        <c:choose>
            <c:when test="#{!empty bhMessage}">
                <p><h:outputText value="#{bhMessage}"/></p>
            </c:when>
            <c:otherwise>
                <ui:insert/>
            </c:otherwise>
        </c:choose>
    </div>
</ui:component>

----------------------------------------web.xml--------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    ....
    <context-param>
        <param-name>javax.faces.application.CONFIG_FILES</param-name>
        <param-value>/WEB-INF/faces-config.xml</param-value>
    </context-param>
    <!--context-param>
        <param-name>com.sun.faces.verifyObjects</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.validateXml</param-name>
        <param-value>true</param-value>
    </context-param-->

    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
        <description>
            State saving method: "client" or "server" (= default)
            See JSF Specification 2.5.2
        </description>
    </context-param>
    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.DEVELOPMENT</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.LIBRARIES</param-name>
        <param-value>
            /WEB-INF/yellowwr/custom.taglib.xml;
            /WEB-INF/yellowcp/custom.taglib.xml
        </param-value>
        <!--<param-value>/WEB-INF/yellowwr/custom.taglib.xml</param-value>-->
    </context-param>

    <context-param>
        <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
        <param-value>true</param-value>
    </context-param>


    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <listener>
        <listener-class>com.yellowbook.listener.SessionPageVisitListener</listener-class>
    </listener>

    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!--<servlet>
        <servlet-name>dwr</servlet-name>
        <servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <init-param>
            <param-name>debug</param-name>
            <param-value>true</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>dwr</servlet-name>
        <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>-->


    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>*.htm</url-pattern>
    </servlet-mapping>

    <!-- (to enable directory mapping without the htm extension -->
    <!--<servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/dispatch/*</url-pattern>
    </servlet-mapping>-->

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>AutoComplete Servlet</servlet-name>
        <url-pattern>/autocomplete</url-pattern>
    </servlet-mapping>

    <filter>
        <filter-name>customHibernateFilter</filter-name>
        <filter-class>com.yellowbook.presentation.filter.YBOpenSessionsInViewFilter</filter-class>
        <init-param>
            <param-name>firstSessionFactoryBeanName</param-name>
            <param-value>sessionFactory</param-value>
        </init-param>
        <init-param>
            <param-name>secondSessionFactoryBeanName</param-name>
            <param-value>ybSessionFactory</param-value>
        </init-param>
    </filter>


    <filter>
        <filter-name>DwrFacesFilter</filter-name>
        <filter-class>org.directwebremoting.faces.FacesExtensionFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>DwrFacesFilter</filter-name>
        <url-pattern>/dwr/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>customHibernateFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!--
    <filter-mapping>
        <filter-name>ybHibernateFilter</filter-name>
        <url-pattern>/web-analytics/*</url-pattern>
    </filter-mapping>
    -->

    <filter>
        <description>
            Require that the user log in before accessing any page with
            url-pattern /campaign/*
        </description>
        <filter-name>SecurityFilter</filter-name>
        <filter-class>
            com.yellowbook.filter.security.AnalyticsSecurityFilter
        </filter-class>
        <init-param>
            <param-name>com.superpages.vts.LoginURI</param-name>
            <param-value>/include/login.jsf</param-value>
        </init-param>
        <init-param>
            <description>
                ViewIds for which this filter must not forward back to
                the login page.
            </description>
            <param-name>com.yellowbook.filter.Security.NoForwardViewIds</param-name>
            <param-value>/include/welcome.jsf /campaign/helpCenter.xhtml /campaign/displaySpecAds.xhtml /campaign/components/vervePreviewAd.html</param-value>
        </init-param>
        <init-param>
            <description>
                same as webreach.keyFile defined in webreach.static.properties file through Spring
            </description>
            <param-name>webreach.keyFile</param-name>
            <param-value>/webreach/data/security/key.dat</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/campaign/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/dwr/index.html</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/dwr/interface/jExtensionHelper.js</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <!-- <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/dwr/interface/jBaseManager.js</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/dwr/interface/jAdText.js</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping> -->
    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/dwr/interface/jAdvertiser.js</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/dwr/interface/jClickReport.js</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/dwr/interface/jCallTracking.js</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/dwr/interface/jDailyActivity.js</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <!-- <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/dwr/interface/jDashBoard.js</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>-->
    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/dwr/interface/jUserManager.js</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>
            index.html
        </welcome-file>
    </welcome-file-list>


    <servlet>
        <servlet-name>dwr-invoker</servlet-name>
        <display-name>DWR Servlet</display-name>
        <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <init-param>
            <param-name>debug</param-name>
            <param-value>true</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>dwr-invoker</servlet-name>
        <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>

    <!--TODO: setup JAWR to reenable this-->
    <!--<servlet>
        <servlet-name>ResourceServlet</servlet-name>
        <servlet-class>net.jawr.web.servlet.JawrServlet</servlet-class>
        <init-param>
            <param-name>configLocation</param-name>
            <param-value>jawr.properties</param-value>
        </init-param>
        <init-param>
            <param-name>mapping</param-name>
            <param-value>/resources/*</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>ResourceServlet</servlet-name>
        <url-pattern>/resources/*</url-pattern>
    </servlet-mapping>-->

    <!--<error-page>
        <error-code>500</error-code>
        <location>/include/error.jsf</location>
    </error-page>-->

   <!--  <security-constraint>
        <web-resource-collection>
            <web-resource-name>Automatic SLL Forwarding</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>
                CONFIDENTIAL
            </transport-guarantee>
        </user-data-constraint>
    </security-constraint> -->

</web-app>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值