WebLogic Portal Portlet Development
Simon Yang
Principal Sales Consultant
议程议程议程议程
• Portlet Types
• Portlet开发
• Asynchronous Portlet
Portal Desktop with Portlets
支持的支持的支持的支持的Portlet类型类型类型类型
• Java Server Page (JSP) and HTML Portlets
• Java Portlets (JSR 168)
• Java Page Flow Portlets
• Java Server Faces (JSF) Portlets
• Browser (URL) Portlets
• Struts Portlets
• Remote Portlets
创建创建创建创建Portlet
Java Server Page (JSP) and HTML
Portlets
• JSP portlets and HTML portlets point to JSP or HTML
files for their content. These portlets can be simple to
implement and deploy, and they provide basic functionality
quickly. However, this type of portlet does not enforce
separation of business logic and the presentation layer.
Java Portlets (JSR 168)
• JSR 168 (Java Portlet) is a Java specification that aims at
establishing portability between portlets and portals. These
APIs cover areas such as presentation, aggregation, security,
and portlet life cycle.
Java Page Flow Portlets
• A Java page flow portlet uses Apache Beehive
page flows to retrieve its content. This portlet type
allows you to separate the user interface code from
navigation control and other business logic, and
provides the ability to implement both simple and
advanced portlet navigation.
Struts Portlets
• Struts portlets are based on the Struts framework,
which is an implementation of the Model-View-
Controller (MVC) architecture
• you can give the Struts application a portal user
interface by creating portlets, add personalization
and campaign functionality, and take advantage of
WebLogic Portal's content and user management
services.
Java Server Faces (JSF) Portlets
• The Java Server Faces (JSF) specification, JSR 127,
defines a user interface framework that simplifies
development and maintenance of Java applications that
run on a server and are displayed and used from a client.
• The portal-specific tasks for incorporating a JSF
application into WLP are:
• Create a .portlet file with a facesContent control.
• Insert the namingContainer JSP tag as an immediate child of the JSF
view tag
• JSF Portlet Support in Portal 10.0
• Builds on the 9.2 FacesContent support
• Refactored JSF integration points
• Supports both JSF 1.1 and 1.2
• Support for JSR 168 JSF Portlet Bridges
• IPC improvements
• Improved WSRP integration
JSF Support
Legend
1. JSF Portlet Type
2. New faces-
config.xml
2
1
JSF is supported as a WSRP Resource.
Browser (URL) Portlets
• Browser portlets display HTML content from an
external URL. Unlike other portlet types that are
limited to displaying data contained within the
portal project, browser portlets display URL
content that is external from the portal project
Remote Portlets
• WebLogic Portal can act as either a WSRP remote
producer or as a consumer.
Portlet类型的优势类型的优势类型的优势类型的优势/劣势劣势劣势劣势…
Implementation is more complex.
Advanced page flow features are
not necessary for static or simple,
one view portlets.
Allows separation of the user interface code
from navigation control and other business logic.
Provides the ability to implement both simple
and advanced portlet navigation.
Allow you to quickly leverage Java controls,
web services, and business processes.
Provides a visual environment to build rich
applications based on struts.
Java Page Flow
Less control over formatting.
Lacks certain features of other
portlet types, such as Content Path
and Error Path.
No IPC support
Allows a portlet to display content from a URL
that is outside the portal project.
Provides a "no development needed" portlet for
quick implementation.
Browser
Lack of advanced portlet features
that are available with some other
portlet types.
Requires a deeper understanding of
the J2EE programming model.
Accommodates portability across platforms.
Does not require the use of portal server-specific
JSP tags.
Behavior is similar to a servlet
Java (JSR 168)
Does not enforce separation of
business logic and presentation
layer.
Not well-suited for advanced
portlet navigation.
Simple to implement and deploy.
Provides basic functionality without complexity.
JSP/HTML
劣势优势Portlet类型
…Portlet类型的优势类型的优势类型的优势类型的优势/劣势劣势劣势劣势
Implementation is more complex.
Your application's features might
not be able to be as robust; for
example, some Javascript might
not perform correctly.
Depending on the environment,
might have a performance cost
Allows you to functionally and operationally de-
couple applications within your portal.
Allows you to leverage external sources for
portlet content.
Depending on the environment, might improve
performance
Remote
Not quite as robust as page flow
portlets, which are based on
Beehive. For new development,
page flow portlets provide a better
solution.
Provides a flexible control layer based on
standard technologies like Java Servlets,
JavaBeans, ResourceBundles, and XML.
Provides a more structured approach for creating
and maintaining complex applications.
Useful for importing existing applications.
Struts
All postbacks to a JSF application
are expected to be done using a
POST; the GET method is not
supported.
Allows component-based development of pages
that can handle their own intra-page events.
Simplifies separation of the user interface code
from navigation control and other business logic.
Provides the ability to implement both simple
and advanced portlet navigation.
Allow you to quickly leverage Java controls, web
services, and business processes.
JSF
劣势优势Portlet类型
议程议程议程议程
• Portlet Types
• Portlet开发
• Asynchronous Portlet
Portal组成部分组成部分组成部分组成部分
Portlets开发开发开发开发
Portal
JSR 168
JSR 127JSR 168
JSR 127JSR 168
JSR 127JSR 168
JSR 127
JPF/Struts
Web AppJPF/Struts
Web AppJPF/Struts
Web App
JSPs
JSPs
JSPs
JSPs
WSRP
WSRP
WSRP
WSRP
Portal Framework
Single Sign On Look and Feel State Maintenance Inter-portlet comm.
P
o
r
t
a
l
B
u
s
i
n
e
s
s
S
e
r
v
i
c
e
s
Content
Search
Collaboration
Commerce
Interaction
Management
I
n
t
e
l
l
i
g
e
n
t
A
d
m
i
n
i
s
t
r
a
t
i
o
n
Role/Rule
Based
Entitlements
Role/Rule
Based
Delegated
Admin
JPF/Struts
Web App
Detached Portlets
• WLP supports the use of detached portlets, which
provide popup-style behavior. Technically, a
detached portlet is defined as anything outside of
the calling portal context. Any portlet type
supported by WLP can be rendered as a detached
portlet. Detached portlet are not visible or
accessible from the WebLogic Portal
Administration Console portlet library
• use the standalonePortletUrl class or associated
JSP tag to create URLs to detached portlets
Inlined Portlets
• A file-based portlet can exist either as a stand-
alone .portlet file or as an inlined portlet
• Inlined portlets are created under the following
circumstances:
• If you create a remote book or page that contains portlets,
those portlets will be inlined in the .book or .page file.
• If you use the Export/Import Utility to extract a .book
or .page file that contains portlets, those portlets will be
inlined if they were originally inlined. If the original
page contained referenced portlets, they will be
referenced when the page is extracted.
Portlet属性属性属性属性
Portlet Appearance and Features
• Appearance/rendering characteristics and portlet-
specific features include the use of title bars and
associated states (minimize, maximize, float, and
delete) and modes that affect portlet content (edit
mode, help mode, and custom modes).
• Portlet Dependencies
• Portlet Modes
• Creating Custom Modes
• Portlet States
• Portlet Title Bar Icons
• Portlet Height and Scrolling
Advanced Portlet Development with JSP
Tag Libraries
• ActiveMenus: The ActiveMenus JSP tag library lets you set up a popup
menu that displays when the mouse hovers over specific text. An
activemenus-config.xml file controls the contents of each menu
• DragDrop: You must identify draggable objects that are displayed on a
JSP, and identify drop zones that are configured to react to a dropped
draggable object. The drop zones react by triggering Page Flow actions,
calling JavaScript functions, or posting data to a servlet
• DynamicContent: The DynamicContent tags let you use an AJAX
request to update part of a JSP page within a Page Flow-based portlet.
The tags allow parts of the page to be updated without performing a full
portal request
• UserPicker: The UserPicker:popupButton tag provides the developer
with the ability to add a form button to a JSP page which opens a popup
window that displays a list of current users.
Importing and Exporting Java
Portlets
议程议程议程议程
• Portlet Types
• Portlet开发
• Parallel Rendering & Asynchronous Portlet
Parallel Portlet Rendering
• In the context of WebLogic Portal, forking
(either pre-render or render) refers to page
processing that occurs on the server; multiple
threads are spawned to process each portlet.
In contrast, asynchronous portlet content
rendering refers to page processing that
occurs on the client browser; multiple threads
are spawned, using AJAX or IFRAME
technology.
• Pre-Render Forking: the Fork Pre-Render
attribute enables forking (multithreading) in
the pre-render life cycle phase.
• Render Forking: The Fork Render attribute
enables forking (multithreading) in the render
life cycle phase
Asynchronous Portlet Execution
• By default, the portal framework:
• Executes portlets synchronously
• Requires users to wait for all portlet processing to
complete
• Alternatively, a "slow" portlet can be processed
asynchronously:
• Processing and rendering are done in a separate thread of
execution
• All portlet implementation types are supported
• Portlet Async Content Rendering is a set of features that
allows the content of a portlet to be rendered independently
of the surrounding portal page.
• Enabling Portlet Async Content Rendering is a simple
matter of setting a single attribute on a Portlet definition.
Do not need to refresh the whole page…
Configure an Asynchronous Portlet
• Two asynchronous implementations are supported:
• Internal Frame (IFRAME)
• Asynchronous JavaScript and XML (AJAX)
Async Rendering - AJAX
1
2
3
Legend
1. Async Tag
2. Independent
Rendering
3. Independent
Rendering
Async Rendering - iFrame
1
2
Legend
1. Async Tag
2. Independent
Rendering
3. Redering inside
an iFrame
3
AJAX vs. IFRAME
Works only with Javascript
enabled
Does not currently support
XHTML
Generally perceived as
providing a more intuitive
user experience
Provides a single document
for full-featured portlet
development tasks, such as
cross-portlet drag and drop
Provides better Look & Feel
integration
AJAX
Generally perceived as
providing a less intuitive user
experience
Can complicate more full-
featured portlet development
tasks, such as cross-portlet
drag and drop
Works with Javascript
enabled or disabled
Support for embedded
media (non-HTML) files
Supports XHTML.
IFRAME
Disadvantages Advantages Type
Considerations
• Control Tree Lifecycle Behavior – must test existing
application.
• Backing and Presentation Contexts: two new methods have
been added to PortletBackignContext and
PortletPresentationContext classes.
• public boolean isAsyncContent()
• public boolean isAsyncContentOnly()
• IPC, Events & Control State Management: For example,
events generated by portlet content may not effect the
portal page.
• Look and Feel Considerations: Ideally the asynchronous
rendering of a portlet's contents should be as non-intrusive
as possible to the end user.
Forked/Conventional Rendering and
Asynchronous Rendering
IPC not supported, although
some workarounds exist for
AJAX asynchronous portlets.
IPC supportedIPC Support
Requires n + 1 requests
(where n is the number of
asynchronous portlets)
Requires only one request. Rendering requests
Refresh required only for an
individual portlet.
Entire page refreshes when
interaction occurs on any portletRefresh
Page uses AJAX or IFRAME for
rendering.
No changes between
conventional rendering and
forked rendering
HTML page
Portal page does not include
portlet content (less information
needs to be returned by the
server); page starts loading faster
Server response to page request
includes content of page Page request/response
Page, and portlet frames, render
immediately; individual portlet
content renders as processing
completes
Page does not render until all
portlet processing is complete
Completed rendering of
page
Asynchronous Rendering
Forked or Conventional
Rendering
Behavior/Feature
Q&A
Thank You!Thank You!
本文档为【04_Portlet开发】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。