Open-Open

          皇家撒拉哥薩
          posts - 32, comments - 3, trackbacks - 0, articles - 1

          jetspeed開發實戰

          Posted on 2006-07-16 11:02 開源愛好者 閱讀(1017) 評論(0)  編輯  收藏 所屬分類: Portal
          jetspeed開發實戰

          這里假設monsys為web服務的名稱,其路徑在webapps/下面
          1,jetspeed的圖片處理圖片默認放在monsys/images下面,
          調用方法:$clink.setURI("images/test.jpg")
          2,javascript處理 javascript默認放在monsys/javascript下
          調用方法:$clink.setURI("javascript/test.css")
          3,portlets的位置位于monsys/WEB-INF/templates/vm/portlets/html下面
          4,頁面總體布局控制看JetspeedResources.properties
          bottomnav.enable=true
          bottomnav.vm=bottom.vm
          leftnav.enable=true
          leftnav.vm=left.vm
          leftnav.width=10%
          topnav.enable=true
          topnav.vm=top.vm
          topnav.logo.file=images/jetspeed-logo-1.5.gif
          topnav.logo.url=
          topnav.user_login.enable=true
          topnav.user_creation.enable=true
          topnav.my_pages.enable=true
          5,portlets源代碼分析: portlet主要實現三個方法:
          <1>,buildMaximizedContext最大化
          <2>,buildConfigureContext顯示信息
          <3>,buildNormalContext正常情況,也就是所看到的正常顯示時所要顯示的信息
          <4>,調用時,在添加模塊時添加新參數action=portlets.GraphDailyAction
          package org.apache.jetspeed.modules.actions.portlets;
          import .............(N個,略)
          public class GraphDailyAction extends VelocityPortletAction {
          /**
          * Subclasses should override this method if they wish to
          * build specific content when maximized. Default behavior is
          * to do the same as normal content.
          */
          protected void buildMaximizedContext(VelocityPortlet portlet, Context context, RunData rundata) {
          buildNormalContext(portlet, context, rundata);
          String text = (String) context.get("text");
          if (text == null) {
          text = "Top Record of baccarat game";
          }
          context.put("text", text + " (Maximized !)");
          }
          /**
          * Subclasses should override this method if they wish to
          * provide their own customization behavior.
          * Default is to use Portal base customizer action
          */





          protected void buildConfigureContext(VelocityPortlet portlet, Context context, RunData rundata) {
          buildNormalContext(portlet, context, rundata);
          setTemplate(rundata, "hello-customize");
          }
          /**
          * 這是主要部份
          * Subclasses must override this method to provide default behavior
          * for the portlet action
          */





          protected void buildNormalContext(VelocityPortlet portlet, Context context, RunData rundata) {
          String mode = portlet.getPortletConfig().getInitParameter("mode"); //讀取添加模塊時從配置文件傳來的參數
          String searchdate = rundata.getParameters().getString("searchdate"); //取得從頁面提交得到的參數
          context.put("mode", mode);
          context.put("searchdate", searchdate) //輸出頁面要顯示的信息,支持輸出數組,對像,及容器等形式的數據
          }
          }

          <5>寫好源代碼,并編譯,參考里的:  
          1,<3>所建的參數action,其值為portlets.GraphDailyAction,則系統會去執行這個類
          (轉載文章請保留出處:Java家(www.javajia.com))
          主站蜘蛛池模板: 青岛市| 云阳县| 丰都县| 麟游县| 长沙县| 星子县| 乐都县| 仙居县| 西昌市| 邯郸县| 怀集县| 岑溪市| 延庆县| 铁岭市| 莲花县| 万盛区| 大庆市| 焦作市| 东至县| 射阳县| 松桃| 陇川县| 靖西县| 永嘉县| 满城县| 财经| 康马县| 松滋市| 通州区| 河间市| 巫山县| 岢岚县| 武山县| 诸城市| 荥经县| 泽州县| 洛宁县| 紫金县| 彝良县| 乌鲁木齐市| 河东区|