Show TOC

Creating a Portal ComponentLocate this document in the navigation structure

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
  1. Start the Portal Application Object wizard by right-clicking the portal application project and then selecting Start of the navigation path New Next navigation step Create Portal Application Object End of the navigation path.

    Note

    You can also open the wizard by doing one of the following:

    • From the File menu, select Start of the navigation path New Next navigation step Other End of the navigation path. Under Portal Application , select Create a Portal Application Object , and then click Next .

    • In the toolbar, click Create a Portal Application Object.

    • Open the portalapp.xml file for the application, and click Create on the Services tab.

  2. Select the portal application project in which to add the portal component, and then click Next .

  3. Under Portal Content , select AbstractPortalComponent , and then click Next .

  4. 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.

  5. 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.

  6. 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.