ibm websphere portal blog,websphere portal, portal blog, ibm blog,websphere blog,websphere tips and tricks, websphere interview questions, portal interview questions, portal faqs

How to Send Query Parameter to Menu Component | IBM WebSphere Portal Blog

Pages

Sunday, October 30, 2016

How to Send Query Parameter to Menu Component


<% RenderingContext context = (RenderingCon text)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);

String currentPath = context.getPath();
String currentLibrary = context.getLibrary().getName();
Map myparams = new HashMap();
myparams.put("SiteAreas", currentLibrary+"/mySite/mySiteArea1,"+currentLibrary+"/mySite/mySiteArea2"); %>


Another technique is

<%
RenderingContext context = (RenderingContext)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY); %>

<% String currentPath = context.getPath(); //Getting the library relative path(Ex : /Library/Site/Sitearea/Content)
String lrp=context.getLibraryRelativePath();
String sublrp=lrp.substring(0,lrp.lastIndexOf("/"));
String currentLibrary =context.getLibrary().getName();
Map myparams=context.getRequestParameters();
myparams.put("sitearea", currentLibrary+sublrp); context.setRequestParameters(myparams); %>

Render the content in menu using below statment:
            <wcm:libraryComponent name="menu" library=currrentLibrary />