About Portlet and Portlet API

zhaozj2021-02-16  53

Portlet is the core component of Portal Server, which is Portal application running on Portal Server. Portlets are reusable components that provide access to applications, web-based content and other resources. One page in the portal can contain multiple portlets, while multiple instances of the same portlet can display different data for users.

From a user's point of view, Portlets are a window in the portal page, providing specific services or information, such as providing calendars and news. From a developer's point of view, the portlet is an insertable module running in the portal server portlet container.

We can have three ways to get the required portlet. First, you can modify the portlets of WebSphere Portal make it in line with your own needs; follow you can download what you need from the third-party portlet directory; if both methods do not meet specific needs, you can develop portlets themselves.

1.2 About Portlet API

Simply put, abstract class portlets are the core of Portlet API. The portlet class extends the HTTPSERVLET for the ServelT API. All portlets are inherited from httpservlets, indirectly expand the portlet class, as shown below:

... - javax.servlet.http.httpservlet | - Org.apache.jetspeed.portlet.portlet | - Org.apache.jetspeed.portlet.portletAdapter | - com.mycompany.myApplication.myportlet

Therefore, Portlets are a class of special servlets, which can be easily inserted into Portal Server and run on it. Unlike servlet, portlet cannot send reload or error messages to your browser, and forward requests or write dedicated tags to output streams.

Compared with servlet, portlet has stronger dynamics that can be updated without restarting Portal Server:

You can use the portal management interface to install and remove the portlet application portlet can be changed by administrators with appropriate access to manage portlets to dynamically create and delete portlet.

The portlet container depends on the J2EE architecture. Portlets are packaged into a WAR file similar to the J2EE web application and deployed in a way similar to servlet. Similar to other servlets, use the servlet deployment descriptor (web.xml) to define the portlet to the application server, this file defines the class file of the portlet and read-only initialization parameters. In addition, portlet must provide a portlet.xml to define the portal server to Portal Server.

转载请注明原文地址:https://www.9cbs.com/read-16966.html

New Post(0)