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

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

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

    kapok

    垃圾桶,嘿嘿,我藏的這么深你們還能找到啊,真牛!

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      455 隨筆 :: 0 文章 :: 76 評論 :: 0 Trackbacks
    使用Eclipse plus Pluto開發你的第一個與JSR168兼容的Portlet
    By Terry.li
    SpiritSeekerS@sqatester.com[/pre]

    本文將介紹開發基于Portlet Specification v1.0 (JSR168) 的Portlet應用.  
    我們使用Pluto作為Portlet Container和Portal. 同時可以將開發的Portlet應用遷移到任何支持JSR168的Portlet Container上.

    ·    為什么要發布Portlet Specification? 什么是JSR168? 
    由于越來越多的公司開發了各自的Portal組件和基于其的Portal產品(如Bea, IBM, Oracle, Sun, Sybase, Novell, SAP, Jetspeed, Vignette 等.這種互不兼容的接口實現不斷帶給程序提供商各種問題和麻煩, 為了解決這種問題, JCP發布了JSP168 (Java Specification Request), Portlet Specification, 用以提供不同Portal和Portlets之間的互用性

    ·    什么是Portal?
    Portal是基于WEB的應用程序, 它將不同資源進行整合并展現給用戶
    通常其有如下三個特點:

    a.    Personalization (個性化) 
    b.    Single sign on (單點登陸)
    c.    Content aggregation (內容聚合) 

    其中Content aggregation指的是將不同來源的信息整合到一個頁面中用來讓用戶更方便的進行使用. 
    比如, 如果某客戶需要進行一次商業采購,以往需要訪問不同的供應商的主頁得到相關信息, 但如果使用Portal將所有不同的貨物供應商的商品catalog頁面都整合到一個Catalog Portal頁面中, 那么所有的商品信息都可以更快的進行瀏覽,篩選和定貨, 加快了客戶的商業運作效率.

    ·    什么是Portlet?
    Portlet是一種基于WEB組件的JAVA技術, 由Portlet Container進行管理. 處理請求并動態返回頁面, 可以做為Portal 的可拔插的用戶界面組件.
     
    ·    什么是Portlet Container? Portlet Container用來管理Portlet的生命周期并且提供其運行所需要的必要環境. 并且為Portlet Preferences提供持久性(Persistent)存取服務.但是其不支持內容的Aggregation. Aggregation由Portal組件提供.

    注: Portlet Preferences是Portlet的一個新特性,提供類似數據庫的功能.但是不是用來取代數據庫. 只是用來存取簡單的Portlet參數配置.
            
    ·    什么是WSRP?
    WSRP 是 OASIS Web Service for Remote Portlets的縮寫. WSRP主要用來簡化Portal對于各種資源或者程序的整合的復雜性, 可以避免編程帶來的整合的復雜性. 并且Portal的管理員可以從大量的服務中選擇需要的用以整和到Portal中. 


    ·    Portlet and Servlet

    摘自(Portlet Specs v1.0)

    相同點:
    ? Portlets are Java technology based web components
    ? Portlets are managed by a specialized container
    ? Portlets generate dynamic content
    ? Portlets lifecycle is managed by a container
    ? Portlets interact with web client via a request/response paradigm

    不同點:
    ? Portlets only generate markup fragments, not complete documents. The Portal aggregates portlet markup fragments into a complete portal page
    ? Portlets are not directly bound to a URL 
    ? Web clients interact with portlets through a portal system
    ? Portlets have a more refined request handling, action requests and render requests
    ? Portlets have predefined portlet modes and window states that indicate the function the portlet is performing and the amount of real state in the portal page
    ? Portlets can exist many times in a portal page

    Portlet特有:
    ? Portlets have means for accessing and storing persistent configuration and customization data
    ? Portlets have access to user profile information
    ? Portlets have URL rewriting functions for creating hyperlinks within their content, which allow portal server agnostic creation of links and actions in page fragments
    ? Portlets can store transient data in the portlet session in two different scopes: the application-wide scope and the portlet private scope

     Servlet特有:
    ? Setting the character set encoding of the response
    ? Setting HTTP headers on the response
    ? The URL of the client request to the portal
      
    ·    什么是Pluto ?
            Pluto 是 Apache開發下的一個Open Source項目, 是基于Portlet Specs的一個 Portlet Container 的實現. 它也提供了Sample Portal實現. 但是功能相對簡單:

          例如,
          1) 沒有復雜的Layout實現.
          2) 不是multi-user enabled, 比如, 不同User之間的Portlet Preferences互相是可以share的.   

         請記住Pluto只是一個Portlet Container的實現, 不是一個Portal的實現. 如果你需要功能更為強大的Portal,可以使用JetSpeed , 它同樣也是Apache的一個Open Source Project. 請參考文章末尾的資源部分.

    ·    概念 
          如圖: Figure 1.1
    a.    Decorations and controls (修飾部分及 控制部分)
    b.    Portlet fragment (Portlet 片段)
    c.    Portlet window (Portlet 窗口)
    d.    Portlet page (Portlet 頁面)

     
     
    Figure 1.1

    ·    開發工具( Eclipse2.1, Pluto-plugin, Jakarta-tomcat-4.1.29)
    下載地址:
    Eclipse
    http://www.eclipse.org/downloads/index.php

    Pluto-plugin
    http://prdownloads.sourceforge.net/plutoeclipse/org.eclipsefan.pluto.ui_1.0.0.zip?download

    Tomcat4.1
    http://mirrors.midco.net/pub/apache.org/jakarta/tomcat-4/v4.1.29/bin/jakarta-tomcat-4.1.29.zip

    JDK1.4
    http://Java.sun.com

    ·    配置開發環境
           Step1 :  解壓eclipse-SDK-2.1.1-win32.zip
         Step2 :  解壓org.eclipsefan.pluto.ui_1.0.0.zip , 并將其拷入eclipse\plugins目錄
    下, 如下: eclipse\plugins\org.eclipsefan.pluto.ui_1.0.0\
    \Icon
    \Lib
    \Source
    \Webapp

            Step3:  解壓tomat4.1到一目錄. 并且配置好Tomcat服務器.    
            Congratulations, It’s done!

    a. 使用Portlet Wizard 來創建Portal
    1) 選擇File > New > Project… > Portal > Pluto Portal application, 單          擊Next

    2) 指定Project名稱 , 這里使用pluto, 然后單擊Next.




    3) 指定Tomcat路徑, 單擊Finish.  之后eclipse會將Pluto安裝到tomcat上,并且自動配置好環境.



    b. 創建Portlets Application


    1) 創建Pluto portlet application 

            2) 輸入project名稱,這里用portlets


          c. 最后生成的工程如圖 

    d. 通過portlet.xml 生成/更新 web.xml 


    e. 部署 Portlets

    1) 編譯 portlets 工程.
    2) 在 [your tomcat installation directory]/webapps下, 新建目錄portlets
    3) 將portlets工程下的web-root目錄下所有文件, 拷入以上新建的portlets目錄中.
    Tip: 如果在每次修改后你厭倦了Ctrl+C 和 Ctrl+V, 你可以在Portlets工程目錄下自己編一個Bat文件, 然后你可以在eclipse里的Package Explorer中看到它, 雙擊就可以了. 其中deploy.bat文件就是實現其功能的.

    4) Start tomcat.
    5) 在IE 中輸入: http://localhost: 8080/pluto/portal, 你應該能看到portal 頁面.


    ·    Sample Portlet
    在Portlets工程文件創建過程中, 自動生成許多文件, 包括一個簡單的Portlet, 我們來觀察一下生成的sample portlet.


    1) 與Servlet非常類似, Portlet擴展自GenericPortlet
        
        import javax.portlet.*;

    public class SimplePortlet extends GenericPortlet

    2) 其三個方法對應了Portlet 標題欄中的三個聯接 (View, Edit, Help)

    public void doView(…)

    public void doEdit(…)

    public void doHelp(…)

     
    Figure 1.9

    3) 三個方法分別調用了三個JSP文件, 用以生成Portlet fragment, 同樣也可以調用Servlet產生Portlet fragment. 與Servlet應用類似,也可以使用
    getInitParameter(String s)方法,得到配置文件中Portlet的初始值. 只不過Servlet使用web.xml,而Portlet 使用portlet.xml文件.


    portlet.xml

               <init-param>
                <name>jspView</name>
                <value>/jsp/view.jsp</value>
    </init-param>


    SimplePortlet.java

    String jspName = 
    getPortletConfig().getInitParameter("jspView");


    ·    Portlet Tag library

    1)defineObjects Tag

    如果打開其中的一個JSP文件,你會發現,和Servlet一樣,JSP中可以使用Portlet的一些variables.例如:

    renderResponse
    renderRequest
    portletConfig

    但是必須聲名:
    <portlet:defineObjects/>
    其中不可以定義任何屬性或者包含任何內容.

    2) actionURL Tag
    屬性    值類型    對應值
    windowState    String    minimized, normal, maximized
    portletMode    String    view, edit, help
    var    String    任何值
    secure    String    true,false

    <portlet:actionURL windowState=”normal” portletMode=”edit”>
    <portlet:param name=”action” value=”login”/>
    </portlet:actionURL>

    創建一個action URL , 當訪問它時將使portlet window變為normal 裝態, 模式變為 edit.

    3) renderURL Tag
    屬性    值類型    對應值
    windowState    String    minimized,normal,maximized
    portletMode    String    view, edit, help
    var    String    任何值
    secure    String    true,false

    <portlet:renderURL portletMode=”view” windowState=”maximized”>
    <portlet:param name=”number” value=”1”/> 
    <portlet:param name=”page” value=”2”/>
    </portlet:renderURL>

    創建一個render URL , 當訪問它時將使portlet window變為maximized裝態, 模式變為 view.
     
    4) namespace Tag
    為目前的Portlet產生一個唯一的Value. 防止和其他的Portlet 或者Portal頁面上的value產生沖突.
    <A HREF=”javascript: <portlet:namespace/>doFoo()”>Foo</A>

    5) param Tag
    屬性    值類型
    name    String
    <portlet:param name=”myParam” value=”someValue”/>
    注: param Tag不可以有body content.


    總結
    Pluto目前是v1.0, 有部分Portlet規范沒有完全實現, 例如, renderResponse.setTitle (), 同時你可以從Apache的CVS下載最新的Pluto代碼, 希望這編文章可以幫大家搭建一個簡單的Portlet開發環境 , 熟悉Portlet相關的知識.


    資源:
    ·    Pluto 
    http://jakarta.apache.org/pluto

    ·    Pluto Mail List
    http://news.gmane.org/gmane.comp.jakarta.pluto.user

    ·    WSRP Spec1.0
    http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wsrp

    ·    Apache的WSRP實現
    http://ws.apache.org/wsrp4j/

    ·    Apache’s Portal, JetSpeed:
    http://jakarta.apache.org/jetspeed/site/index.html

    ·    JSR 168: 
    http://www.jcp.org/en/jsr/detail?id=168
    ·    "Portlet 規范介紹" By Stefan Hepper 和 Stephan Hesmer 
    o    Part 1: Get your feet wet with the specification's underlying terms and concepts (August 2003) 
    o    Part 2: The Portlet API's reference implementation reveals its secrets (September 2003) 
    posted on 2005-04-20 07:27 笨笨 閱讀(3494) 評論(3)  編輯  收藏 所屬分類: J2EEALLWeblogic Portal

    評論

    # re: 使用Eclipse plus Pluto開發你的第一個與JSR168兼容的Portlet 2005-11-02 18:06 jaceke
    這是什么年代的文章了啊 麻煩更新一下可以嗎  回復  更多評論
      

    # re: 使用Eclipse plus Pluto開發你的第一個與JSR168兼容的Portlet 2006-01-23 10:34 testing
    就是。轉人家的貼子也要弄點新的啊!浪費大家的時間。  回復  更多評論
      

    # re: 使用Eclipse plus Pluto開發你的第一個與JSR168兼容的Portlet 2009-04-14 13:16 浪費時間
    真是的  回復  更多評論
      

    主站蜘蛛池模板: 两个人www免费高清视频| 美女免费精品高清毛片在线视| 亚洲av片劲爆在线观看| 亚洲A∨无码一区二区三区| 国产精品免费久久久久久久久| 日韩电影免费在线观看中文字幕| 很黄很黄的网站免费的| 免费看a级黄色片| 亚洲av麻豆aⅴ无码电影| 国产亚洲精品看片在线观看 | 全黄a免费一级毛片人人爱| 亚洲三区在线观看无套内射| 亚洲精品福利你懂| 老司机精品免费视频| 久久亚洲综合色一区二区三区| 亚洲爆乳成av人在线视菜奈实| 99re8这里有精品热视频免费| 成年私人影院免费视频网站| 亚洲AV无码久久寂寞少妇| 国产精品亚洲综合天堂夜夜| 69天堂人成无码麻豆免费视频| 亚洲一区二区三区四区视频 | 日本不卡免费新一二三区| 久久亚洲AV成人无码| 日本一区二区在线免费观看 | 亚洲AV无码久久精品成人| 日韩免费一区二区三区在线 | 在线A亚洲老鸭窝天堂| 国产亚洲精品美女| 中文字幕亚洲一区二区三区| 嫩草影院在线播放www免费观看| 亚洲精品视频久久| 久久久久免费看成人影片| 国内精品免费麻豆网站91麻豆| 亚洲人成影院在线高清| 91香蕉国产线在线观看免费| 久久久久亚洲国产| 夫妻免费无码V看片| 亚洲午夜无码久久久久软件| 噼里啪啦电影在线观看免费高清| 亚洲国产成人va在线观看网址|