Portlet development

zhaozj2021-02-16  61

Developing a portlet is usually the following steps:

Set the environment for developing portlet applications Creating portlet applications Compiling portlet applications to customize portlet.xml Deployment portlet application debugged portlet application

2. General Method for Gateway Web Application

When the portal Web enterprise is applied, the EJB module in the app will be reserved as a background application. We generally do not need to be modified. It is usually only necessary to transform the original Web modules into Portal applications.

2.1 Reconstruction of servlet into portlet

Reconstruction of servlets into portlets generally requires the following steps:

Change the definition of the servlet to inherit the portlet or its subclasses. Portlets are not directly extended httpservlets, they extend the child class of Portlets (extended from httpservlets) or portlets, such as portletadapter. Modify the init () method. Due to the portlet inherits the portlet or its subclasses, you need to call the corresponding init () method. Transform Doget, Dopost and other methods into an appropriate MODE method. Doget, Dopost, etc. will not be used directly in the portlet, replacing them will be appropriate MODE methods, such as Doview, Doedit, Docunt, Dohelp, etc., but at least to define the Doview method for the portlet.

2.2 Modify JSP

Delete all the tags of all the page, such as,,

Wait. In Portal, each portlet only provides partial tags, and then assembles a complete page by the portlet framework. Portal will implant the JSP output into other code snipples, so you need to confirm that the tag is complete, JSP does not include an open label and contains only valid HTML, WML, or Chtml.

Code naming elements (such as forms, global variables, Java scripts Function names) in the namespace. In Portal, each portlet runs in its own unique namespace. Element coding can avoid conflicts with other pages or other portlets in the same page (for example, there are two portlets in a page, they have the same form name, which will appear naming conflicts. Coding two forms, Portal These two forms will be able to distinguish between these two forms.

2.3 Add portlet deployment descriptor

In addition to the servlet deployment descriptor (Web.xml), portlet must provide a portlet.xml to define the features of portlets in Portal Server. This information includes a specific portlet or portlet application configuration parameter and all portlets, such as the type of portlets supported, and the like. Portal Server uses this information to serve the portlet.

2.4 Add EJB Client Repayment

In order to enable portlets to use the WEB application EJB, we need to add EJB client to the lib directory to the portlet application.

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

New Post(0)