没有合适的资源?快使用搜索试试~ 我知道了~
首页dojo version 1.0 websphere 6 workable sample
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/349878/bg1.jpg)
Using the Dojo Toolkit with WebSphere Portal
Adding sizzle to your portal application user interface
Karl Bishop (kfbishop@us.ibm.com), Senior Software Engineer, IBM
Doug Phillips (dougep@us.ibm.com), Advisory Software Engineer, IBM
November, 2007
© Copyright International Business Machines Corporation 2007. All rights reserved.
This article describes how to use and leverage the Dojo toolkit in portal applications.
Dojo is a JavaScript™ based toolkit that you can use to enhance your portal with a rich
set of widgets and dynamic interactivity that customers expect from today's modern Web
applications. The article guides you through the installation and configuration of Dojo,
and helps you use it with IBM® WebSphere® Portal. Then, it shows you how to take
advantage of the features provided with Dojo.
To get the most out of this article, you should have a good understanding of JavaScript
programming, portal administration and development, and have the desire to make your
portal applications sizzle!
1
![](https://csdnimg.cn/release/download_crawler_static/349878/bg2.jpg)
Table of contents
Introduction .......................................................................................................................... 3
Integrating Dojo into your portal applications ..................................................................... 4
Using a cross domain build of Dojo ................................................................................ 4
Custom Dojo enabled theme ............................................................................................ 4
Bundling Dojo with your portlets .................................................................................... 5
Instantiating Dojo ................................................................................................................. 5
Step 1 - Define Dojo dijit theme style ............................................................................. 5
Step 2 - Define the Dojo configuration (djConfig) variable ............................................ 6
Step 3 - Load the core Dojo object .................................................................................. 7
Step 4 - Include additional modules and start something! ............................................... 8
Portal and JavaScript considerations ................................................................................... 9
Portlet namespacing ......................................................................................................... 9
Global static JavaScript .................................................................................................. 10
Dojo specific considerations .............................................................................................. 10
AJAX communications .................................................................................................. 10
Internationalization ............................................................................................................ 13
Dojo events .................................................................................................................... 15
Styling dijits ................................................................................................................... 15
Custom modules ................................................................................................................. 16
Step 1 - Create folder structure ...................................................................................... 17
Step 2 - Create module files ........................................................................................... 17
Step 3 - Register your module's package with Dojo ...................................................... 18
Step 4 - Instantiate your object ...................................................................................... 18
Troubleshooting ................................................................................................................. 19
Debuggers ...................................................................................................................... 19
Logging on the client ..................................................................................................... 19
Sending log messages to a server ................................................................................... 20
Common coding mistakes .............................................................................................. 22
Working with the sample files ......................................................................................... 23
Project: DojoPortal_Theme ........................................................................................... 23
Files: DojoPortalInit.jspf and DojoXDPortalInit.jspf ................................................ 24
File: js/ibm/portal/Portal.js ........................................................................................ 25
Project: DojoPortal_Service ........................................................................................... 26
Project: DojoPortal_Portlets .......................................................................................... 26
File: DojoPortletInit.jspf ............................................................................................ 27
File: js/ibm/portlet/Portlet.js ...................................................................................... 28
Servlet: PortletService ............................................................................................... 30
Portlet: LoggingPortlet ............................................................................................... 30
Portlet: I18NPortlet .................................................................................................... 31
Portlet: SessionPortlet ................................................................................................ 34
Conclusion ......................................................................................................................... 36
Download ........................................................................................................................... 37
Resources ........................................................................................................................... 37
About the authors ............................................................................................................... 38
2
![](https://csdnimg.cn/release/download_crawler_static/349878/bg3.jpg)
Introduction
In the Web 2.0 world, users expect your Web-based applications to provide a rich set of
user interface and interactivity features. Until recently, you had to use proprietary plug-
ins or secondary languages such as Java™, ActiveX, or Flash to add Rich Internet
Application (RIA) features to a Web site. These languages tend to be heavyweight, to
require additional installation from the user, and are often problematic in cross-browser
and cross-platform environments.
With the explosion of Asynchronous JavaScript and XML (AJAX) toolkits, you can now
provide full-featured applications on the browser using native and cross-browser
JavaScript. There are several great AJAX toolkits available, and many of them are open
source. This article focuses on the Dojo toolkit, which has a strong architecture, helpful
accessibility and internationalization features, and general feature set. If you hold
allegiance to another toolkit, please read on; most of the issues discussed here generally
apply to any AJAX toolkit.
This article does not get into the details or history of AJAX as a technology. Also, it
assumes that you know how to install new portal themes, create pages, and deploy portlet
and servlet WAR files. See Resources for links to other articles on using native AJAX in
WebSphere Portal if you want to an introduction to these topics.
This article dives right into getting things done with Dojo inside portal applications. It
does not teach you how to use all of the widgets and features of Dojo; however, you will
get a nice jump start if this is your first foray into the Dojo toolkit.
Enter the Dojo toolkit
The Dojo toolkit (http://dojotoolkit.org) has
undergone a rapid and extreme evolution. The
latest release (as of this writing) is 1.0.0, which
went live on 5 November 2007. This release is a
complete rewrite of the previous versions. It is
lean and fast, and is much easier to use than
previous releases.
The Dojo packaging has been split up to make it
easier to use. These packages include:
• The Dojo core (dojo) package, which includes all the base code.
• The Dojo widgets (dijit) package. Contains the typical form and input elements
(We will let you ponder that package name.)
• The Dojo extras (dojox) package. This final package contains experimental features
and widgets, which might not be fully "baked", so they are not yet ready for inclusion
into the main packages.
3
![](https://csdnimg.cn/release/download_crawler_static/349878/bg4.jpg)
As you will see later in this article, you can also create your own Dojo-based modules to
include in your application.
The primary source of information on Dojo is the online Book of Dojo, and the API
reference (see Resources for links). You are strongly advised to read (or even re-read)
both of these to gain a strong foundation of the capabilities available in the Dojo Toolkit.
Both of these are located on the Dojo Toolkit Web site.
Integrating Dojo into your portal applications
The first thing you need to determine is how you will embed Dojo into your portal
application. You have a few options, and your decision will determine how you start.
Your first decision is if you want to embed Dojo into a custom theme or if you want to
load it from each portlet. Either technique will work fine; however, from an architectural
standpoint, it is much cleaner to use a Dojo-enabled theme. The only reason you would
not be able to use a custom theme is if you are not in control of the portal instance. For
example, if you are providing portlets (as a third party) to portal customers, then you
must have each portlet define its own Dojo environment.
Next, you need to decide if you want to bundle your own local instance of Dojo with your
theme or portlets, or if you want to use a cross-domain build of Dojo. Cross domain
builds of Dojo can be hosted on a company intranet. Alternatively, you can use Dojo
1.0.0 that is hosted on the AOL® Content Delivery Network (CDN).
You learn more about these options later in this article when we explore the merits and
pitfalls of each. All the example code in this article uses the common cross domain build
of Dojo.
Using a cross domain build of Dojo
Obviously, the easiest way to install "something" is to simply not install it at all! No, this
is not as obtuse as it seems in this networked world. Dojo now provides a special build
that can be hosted on a central server within your organization and accessed from any
application, no matter what is the source URL. Previous versions of JavaScript toolkits
and earlier versions of Dojo required that AJAX calls be within the same domain URL.
With a cross domain build of Dojo, this limitation, as it relates to Dojo and its specific
modules, is removed. If you do not want to host the Dojo modules at all, then you can
access the global cross domain build hosted by AOL CDN.
Custom Dojo enabled theme
If you are developing a portal-based application for a company Web site, and it will use a
custom built theme, then you should establish a Dojo base within the theme. Doing this
has several advantages:
• You can define and publish the Dojo version and CSS styling used by all contained
portlets.
4
![](https://csdnimg.cn/release/download_crawler_static/349878/bg5.jpg)
• You get the advantage of a common browser cache instance of the dojo core and
included modules.
• You reduce the amount of boilerplate code that would otherwise be required by each
portlet to instantiate Dojo.
Having a common Dojo base from the theme is a valuable feature. If each portlet defines
its own instance of Dojo, then the first portlet and, therefore, the first Dojo instance
loaded, would take precedence over all other portlets on the page. This could cause some
painful debugging when your portlet is expecting a certain version of Dojo, and a portlet
loaded earlier in the page aggregation instantiated a different version.
Bundling Dojo with your portlets
In cases in which you do not have a custom theme, or you cannot directly make theme
changes, you can instantiate Dojo with each portlet you deploy into portal. In this case,
you need to consider:
• Version mis-match concerns (described above)
• Consistent CSS styling for your dijits
• Added size of the WAR file due to bundling the local Dojo toolkit with your code.
The size issue does not apply if you use a cross domain build of Dojo. Other than these
considerations, there is no harm in instantiating Dojo from within your portlets.
Instantiating Dojo
To use Dojo, you follow these steps, which are described in more detail below:
1. Define Dojo dijit theme styles .
2. Define the Dojo configuration (djConfig) variable .
3. Load the core Dojo object.
4. Include additional modules and start something !
These steps differ slightly depending on whether you use a local instance of Dojo or a
cross domain build.
You can download all the Dojo initialization code, which has been abstracted into JSP
fragments for both theme and portlet instances.
Step 1 - Define Dojo dijit theme style
While this is not technically required to get Dojo started, you might wish to provide
custom styling to the Dojo dijits. Basically, you just need to include the CSS files that
5
剩余38页未读,继续阅读
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/default.jpg!1)
genecomp
- 粉丝: 2
- 资源: 2
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
会员权益专享
最新资源
- BSC关键绩效财务与客户指标详解
- 绘制企业战略地图:从财务到客户价值的六步法
- BSC关键绩效指标详解:财务与运营效率评估
- 手持移动数据终端:常见问题与WIFI设置指南
- 平衡计分卡(BSC):绩效管理与战略实施工具
- ESP8266智能家居控制系统设计与实现
- ESP8266在智能家居中的应用——网络家电控制系统
- BSC:平衡计分卡在绩效管理与信息技术中的应用
- 手持移动数据终端:常见问题与解决办法
- BSC模板:四大领域关键绩效指标详解(财务、客户、运营与成长)
- BSC:从绩效考核到计算机网络的关键概念
- BSC模板:四大维度关键绩效指标详解与预算达成分析
- 平衡计分卡(BSC):绩效考核与战略实施工具
- K-means聚类算法详解及其优缺点
- 平衡计分卡(BSC):从绩效考核到战略实施
- BSC:平衡计分卡与计算机网络中的应用
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)