Creating a Portal Component
Use
A portal component generates HTML that is displayed in a portal iView.
Prerequisites
-
You are currently in the Enterprise Portal perspective of SAP NetWeaver Developer Studio.
-
You have created a portal application project, as described in Creating Portal Application Projects
Procedure
-
Start the Portal Application Object wizard by right-clicking the portal application project and then selecting .
-
Select the portal application project in which to add the portal component, and then click Next .
-
Under Portal Content , select AbstractPortalComponent , and then click Next .
-
In the Portal Component window, enter the following:
-
Name: The name of the portal component. This value is automatically added to the portalapp.xml file for the portal application.
-
Location: Indicates whether the component is added to the src.api or src.core folder. The folder determines whether other applications have access to the class.
-
Class Name: The name of the Java class created for this portal component. By default, the portal name and the class name are the same.
-
Package Name (optional): The name of the package for the newly created Java class.
-
-
Click Finish . The following items are created:
-
A Java class that extends AbstractPortalComponent is created in the src.api or scr.core folder (depending on the value for Location ).
-
A <component> element for the new component is added to the portalapp.xml file of the portal application.
-
-
Add code to the doContent() method to output HTML.
For example, add the following code to display Hello World :
public voiddoContent(IPortalComponentRequest request, IPortalComponentResponse response) { response.write("Hello World"); }
Other Methods
The AbstractPortalComponent class provides empty implementations for several other standard methods for portal components. For example, you can implement doPreview() , which is executed when an administrator previews an iView based on this component, or doEdit() , which is executed when a user personalizes an iView based on this component.

