Setting the Default Layout for a Page
Context
This section describes how to set a page's default layout. A page's default layout is the layout used for rendering if the page's layout has not been personalized.
Procedure
-
Set the parameters for the JNDI lookup.
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); -
Perform a lookup of the page for which you want to set the default layout.
InitialContext iCtx = null; try { iCtx = new InitialContext(env); IPage myPage =(IPage)iCtx.lookup( "pcd:portal_content/Desktop/finance"); ... -
Set the default layout by specifying the layout's atomic name.
myPage.setActiveLayout("narrowWideNarrow"); -
Save the changes.
... myPage.save(); } catch(NamingException e) { }