Skip to Content

Creating a Portal Application Project and deploying it

Portal Application Project:

Starting a new portal application project, from SAP Developer Studio, choose:
File > New > Other

In the left pane choose: ‘Portal Application’

In the right pane choose: ‘Create a portal application project’

In the next screen supply project name, and directory.
The project name will be the name of the EAR file which we use for deploying the project in the portal.
Notice that a project consists from the following directories:
  • classes.api
    • this folder contains the .class files from the compiled portal application objects (sub folders contains package hierarchy).
  • dist
    • this folder contains HTML, JSP, CSS, etc… files. In this folder we can find PORTAL-INF folder, inside PORTAL-INF we can find portalapp.xml file, we would use this file for different configuration for our project (such as, iViews properties, initial parameters, etc…), and for all the sharing reference.
  • src.core
    • this folder contains our sources, presented in folders hierarchy according to the java package hierarchy.

Portal Application Object:

We will add a portal application object which we will later deploy as an iView in the portal, this is a Java file.

Right Click on src.core folder

New > Other
(Figure 2.1)

On the left pane: Portal Application.
On the right pane: Create a new Portal Application Object.
Choose the Project name (created above).
(Figure 2.2)
Portal Component   AbstractPortalComponent.
(Figure 2.3)
Supply Component name (name of the iView), and package.

Figure 2.1

Figure 2.2

Figure 2.3

At this step, you should notice that the file portalapp.xml has been automatically modified and the new iView entry was added:

<component name="MyIView">

      <component-config>

          <property name="ClassName" value="com.sap.portal.somepackage.MyIView"/>

      </component-config>

      <component-profile/>

</component>

In the java file created we have the following method:

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

}

This method parameters are request and response, we would use those parameters in order to receive the request data, and to send response back to the client.
For the first example we would use the “Hello World”, inside the doContent(…) method, write the following: response.write(“Hello World!”);

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

Response.write(“Hello World!”);

}

Building and Deploying our Application:

We would execute export as follows (Right click on the project name):

In the following screen choose EAR file.

Then choose the Project which you want to package.
In the deploy view you can deploy the EAR file

Note: You should configure your server which you want to deploy your EAR into:
Window > preferences > SAP AS Java > Add

Now that you have built and deployed your EAR, you should create an iView, Page and Role in your portal in order to view it’s content.
Please refer the document: Creating an iView from a deployed portal application .ear

Tags:

No comments