Entering content frame

Procedure documentation Adding iViews to a Page Locate the document in its SAP Library structure

This section describes how to add an iView (or page) to a page.

Procedure

...

       1.      Set the parameters for a JNDI lookup in the PCD.

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,
    IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);

env.put(Context.SECURITY_PRINCIPAL, request.getUser());

env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);

       2.      Perform a lookup of the page to which you want to add an iView.

InitialContext iCtx = null;

try

{

    iCtx = new InitialContext(env);

    IPage myPage =(IPage)iCtx.lookup(
       
"pcd:portal_content/Desktop/finance");

}      

catch(Exception e)

{

}

       3.      Create a descriptor (INewObjectDescriptor object) for the iView or page that you want to add to your page.

INewObjectDescriptor iViewDescriptor =
    (INewObjectDescriptor)iViewSrv.instantiateDescriptor
        (CreateMethod.DELTA_LINK,
           
"pcd:portal_content/testxml", request.getUser());

       4.      Add the iView descriptor to the page.

myPage.addiView(iViewDescriptor,"testxml");

The iView is automatically displayed at the bottom of the left-most column of the layout that is currently being used for the page.

If you want to place the iView into a particular column of a particular layout, you can specify a layout container into which to add the iView. The following adds the iView into the com.sap.portal.reserved.layout.Cont2 container (second column) of the current layout:

myPage.addiView(IVtoAdd,"testxml",
   
"com.sap.portal.reserved.layout.Cont2");

com.sap.portal.reserved.layout.Cont2 is the container ID of the second column as defined in the standard narrowWideNarrow layout.

Note

If an iView with the same atomic name exists in the page, an error is thrown.

 

Leaving content frame