Introduction
Due to popular demand, i have decided to post this weblog which shows you how to create a
sitemap
for your portal.
Jar required:
com.sap.portal.navigation.serviceapi.jar
Step 1:
Create a Dynpage project using NWDS or Eclipse wizard.
Step 2:
Add the following lines of code to your Dynpage component
package com.ust.sitemap;
/* Built By: Prakash Singh
Technical Consultant
Universal System Technologies, Inc
2500 W. Lake Mary Blvd., Ste 212-A
Lake Mary, FL 32746 USA
M 407-474-2216
*/
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Locale;
import com.sapportals.htmlb.Form;
import com.sapportals.htmlb.GridLayout;
import com.sapportals.htmlb.GridLayoutCell;
import com.sapportals.htmlb.Group;
import com.sapportals.htmlb.Tree;
import com.sapportals.htmlb.TreeNode;
import com.sapportals.htmlb.enum.CellVAlign;
import com.sapportals.htmlb.enum.GroupDesign;
import com.sapportals.htmlb.page.DynPage;
import com.sapportals.htmlb.page.PageException;
import com.sapportals.portal.htmlb.page.PageProcessorComponent;
import com.sapportals.portal.navigation.INavigationNode;
import com.sapportals.portal.navigation.INavigationService;
import com.sapportals.portal.navigation.NavigationNodes;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
import com.sapportals.portal.prt.runtime.PortalRuntime;
public class display extends PageProcessorComponent {
public DynPage getPage() {
return new displayDynPage();
}
public static class displayDynPage extends DynPage {
/**
*/
public void doInitialization() {
}
/**
*/
public void doProcessAfterInput() throws PageException {
}
/**
*/
public void doProcessBeforeOutput() throws PageException {
Form myForm = this.getForm(); // get the form from DynPage
Group group = new Group();
group.setDesign(GroupDesign.SAPCOLOR);
group.setTitle("Site Map");
myForm.addComponent(group);
GridLayout gl = new GridLayout();
group.addComponent(gl);
IPortalComponentRequest request =
(IPortalComponentRequest) this.getRequest();
IPortalComponentResponse response =
(IPortalComponentResponse) this.getResponse();
try {
NavigationNodes rootNodes = getrootnodes();
int i = 1;
for(Iterator it = rootNodes.iterator(); it.hasNext();){
INavigationNode rootNode = (INavigationNode)it.next();
String title = rootNode.getTitle(Locale.ENGLISH);
Tree tree = new Tree(title, "");
tree.setRootNodeIsVisible(true);
GridLayoutCell cell = new GridLayoutCell(rootNode.getName());
String text = "
BAM! you got yourself a nice sitemap