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

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

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

    隨筆 - 170  文章 - 536  trackbacks - 0
    <2005年11月>
    303112345
    6789101112
    13141516171819
    20212223242526
    27282930123
    45678910

    常用鏈接

    我參與的團隊

    隨筆分類(103)

    搜索

    •  

    積分與排名

    • 積分 - 414020
    • 排名 - 135

    最新評論

    閱讀排行榜

           這幾天一直在用myfaces,遇到一個問題,使用inputDate tree2 這樣的組件的時候,當開啟了一些和JavaScript相關的選項時,總是會提示JavaScript錯誤,但是卻總是找不到這些JavaScript在哪里,很納悶,昨天為了查找 tree2 的用法在網上尋覓,在 JBoss 的論壇看到了相關的問題,其實這個問題在 myfaces 的官方網站上已經有明確的說明了,參見http://myfaces.apache.org/tomahawk/extensionsFilter.html

             引用官方的原文來解釋一下這個問題

    What is the Extensions Filter for?

    Some MyFaces components do more than include some HTML in the pages. They may need additional support scripts, style sheets, images, ...
    Those resources are included in the MyFaces' jar file and the Extensions Filter add the code and URL needed to provide those resources to the generated HTML.

    Some other components, like the file upload component (t:inputFileUpload) need to parse Multipart requests.
    The extensions filter handles this as well.

    Why is this useful?

    This design has several benefits :

    1. It provides a clean separation between MyFaces' components and your webapp.
    2. You don't have to include additional MyFaces' components related code or resources in your pages or webapp.
    3. It provides great flexibility to the MyFaces' team upgrade the components, while keeping transparent backward compatibility.
    4. It makes it possible for complex components to use many support resources without any burden on the page developer.
    5. It loads only the resources really useful for the rendered components.
    6. It handles the MyFaces' resources caching.

    How does it work?

    When a component needs a resource, is calls one of the org.apache.myfaces.component.html.util.AddResource methods (for example AddResource.addJavaScriptToHeader(InputHtmlRenderer.class, "sarissa.js", context); ).
    This method add an attribute to the request so that the filter knows that is must include the given javascript, stylesheet or resource link to the page.
    The code for this resource is automatically included in the generated HTML.
    The URL for an embedded resource is constructed and always begins by /myfaces/ so that it can be intercepted by the filter when the client need to load the resource.
    When the clients fetches the resource, the filter decodes the URL, and serves the proper resource that is embedded in MyFaces' jar.

    How do I configure it?

    In your web.xml, map this filter to the path used for the JSF pages (most likely *.jsf) AND to the /faces/* path as in the following example :

     

    <filter>

            <filter-name>MyFacesExtensionsFilter</filter-name>

            <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>

        <init-param>

            <param-name>maxFileSize</param-name>

            <param-value>20m</param-value>

            <description>Set the size limit for uploaded files.

                Format: 10 - 10 bytes

                        10k - 10 KB

                        10m - 10 MB

                        1g - 1 GB

            </description>

        </init-param>

    </filter>

     

     

    <filter-mapping>

            <filter-name>MyFacesExtensionsFilter</filter-name>

            <url-pattern>*.jsf</url-pattern>

    </filter-mapping>

    <filter-mapping>

            <filter-name>MyFacesExtensionsFilter</filter-name>

            <url-pattern>/faces/*</url-pattern>

    </filter-mapping>

                  

    Under what circumstances am I *required* to use the extensions filter?

    If you just use standard JSF component, but don't use any MyFaces' extended component (beginning with t:), then you don't need the Extensions Filter.
    However, if you use some of the MyFaces' extended components like t:inputFileUpload, t:inputHTtml, t:inputCalendar, ... then you most likely need to have this filter configured in your webapp.

    Does this impact performance?

    The filter hasn't any significant impact the response time.
    However, as the filter has to cache the whole response in memory before writing it out to the client, it slightly increases the memory usage.

    posted on 2005-11-17 08:34 steady 閱讀(1949) 評論(1)  編輯  收藏 所屬分類: JSF & Myfaces

    FeedBack:
    # re: MyFaces' Extensions Filter 2006-03-05 01:00 john_he
    添加以上filter后,如t:inputCalendar要調用js時,總是js出錯。
    有些人還另外添加了
    <filter-mapping>
    <filter-name>ExtensionsFilter</filter-name>
    <servlet-name>FacesServlet</servlet-name>
    </filter-mapping>
    這是怎么回事?  回復  更多評論
      
    主站蜘蛛池模板: 亚洲综合一区国产精品| 亚洲中文字幕在线无码一区二区| 亚洲国产成人无码AV在线影院| 久久久久久久91精品免费观看| 国产亚洲精彩视频| 四虎成人免费影院网址| 狠狠色婷婷狠狠狠亚洲综合| 香蕉视频在线观看免费| 亚洲Aⅴ无码一区二区二三区软件 亚洲AⅤ视频一区二区三区 | 国产精品无码亚洲精品2021| 免费高清在线爱做视频| 亚洲国产成人AV在线播放| 国产成人精品123区免费视频| 337P日本欧洲亚洲大胆精品| 亚洲 综合 国产 欧洲 丝袜| 国产免费区在线观看十分钟| 大地资源免费更新在线播放| 亚洲最大中文字幕无码网站 | 一区二区三区免费视频播放器 | 国产大片91精品免费看3| 深夜免费在线视频| 国产亚洲综合色就色| 在线观看的免费网站无遮挡 | 麻豆一区二区三区蜜桃免费| 亚洲精品无码AV中文字幕电影网站| 亚洲一级黄色大片| 永久免费看bbb| 一个人免费播放在线视频看片| 亚洲AV无码欧洲AV无码网站| 99国产精品永久免费视频| 亚洲AV无码国产精品永久一区| 国外亚洲成AV人片在线观看| 99在线视频免费| 精品无码专区亚洲| 国产成人精品日本亚洲网站| 国产91免费在线观看| 免费国产在线精品一区| 91亚洲va在线天线va天堂va国产 | 国产精品亚洲片在线| 日韩欧毛片免费视频| 有码人妻在线免费看片|