Jetspeed開發文檔2 - 中國WEB開發者網絡 (http://www.webasp.net) -- 技術教程 (http://www.webasp.net/article/) --- Jetspeed開發文檔2 (http://www.webasp.net/article/16/15689.htm) |
| -- 作者:未知 -- 發佈日期: 2004-12-22 |
| Jetspeed開發文檔2
這裡假設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 .............(略) 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>寫好源代碼,並編譯,參考jetspeeed簡單開發文檔.txt裡的: 三,1,<3>所建的參數action,其值為portlets.GraphDailyAction,則系統會去熱行這個類 6,數據庫配置Torque.properties 略 |
| webasp.net |