Skip to main content

developerworkslabel >  Lotus  >  forumlabel  >  Lotus Web Content Management  >  developerWorks

Dynamic menu using JSP component    Point your RSS reader here for a feed of the latest messages in this thread


     

 
 

loginbox.header
 loginbox.welcomelabel loginbox.guestlabel
loginbox.signin
This question is answered.

Permlink Replies: 21 - Pages: 2 [ Previous | 1 2 ] - Last Post: Nov 11, 2009 5:37 PM Last Post By: nitsvault
kriss_sanju

Posts: 103
Registered: Jul 12, 2007 08:38:47 AM
Re: Dynamic menu using JSP component
Posted: Nov 12, 2008 12:30:12 AM   in response to: metkhoo in response to: metkhoothread.responsepost
 
Click to report abuse...   Click to reply to this thread Reply
I have upgraded my portal server and WCM to 6.0.1.4.

The problem is still coming.

The code I am using in the JSP in which I am passing sitearea dynamically and rendering menu is below:

<wcm:initworkspace user="<%= request.getUserPrincipal() %>"/>
<%RenderingContext context = (RenderingContext)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);
String currentPath = context.getPath();
String lrp=context.getLibraryRelativePath();
int i=lrp.lastIndexOf("/");
String sublrp=lrp.substring(0,i);
String currentLibrary =context.getLibrary().getName();
Map myparams = new HashMap();
myparams.put("sitearea", currentLibrary+sublrp); %>
<wcm:setExplicitContext path="<%=currentPath%>" requestParameters="<%=myparams%>"/>
<wcm:libraryComponent name="newsmenu" library=currrentLibrary />

Please help in solving this issue

Regards,
Kishore
kriss_sanju

Posts: 103
Registered: Jul 12, 2007 08:38:47 AM
Re: Dynamic menu using JSP component
Posted: Nov 12, 2008 08:36:42 AM   in response to: kriss_sanju in response to: kriss_sanjuthread.responsepost
 
Click to report abuse...   Click to reply to this thread Reply
Hi Marcus,
If i remove the tag <wcm:setExplicitContext path="<%=currentPath%>" requestParameters="<%=myparams%>"/>
from the above code it is working fine.

But I was unable to pass query string to the menu.

It would be great if you provide me the way to pass a query string to the menu.

Regards,
Kishore
kriss_sanju

Posts: 103
Registered: Jul 12, 2007 08:38:47 AM
Re: Dynamic menu using JSP component
Posted: Nov 19, 2008 01:40:16 AM   in response to: metkhoo in response to: metkhoothread.responsepost
 
Click to report abuse...   Click to reply to this thread Reply
Hi Marcus,
I got the solution to pass query dynamically to menu.
The code is as below:

<wcm:initworkspace user="<%= request.getUserPrincipal() %>"/>
<%RenderingContext context = (RenderingContext)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);
String currentPath = context.getPath();
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); %>
<wcm:libraryComponent name="menu" library=currrentLibrary />

The problem is with the tag <wcm:setExplicitContext path="<%=currentPath%>" requestParameters="<%=myparams%>"/>
Now I have removed that ,after removing I was unable to set parameters so instead of getting Map object from java.util.HashMap() .I got it from the context.getRequestParameters();

Which resolved my issue.
Now I am able to pass the query to menu dynamically.

Thank you for your help.
Your suggestions helped me a lot.

Thank You.........

Regards,
Kishore
kriss_sanju

Posts: 103
Registered: Jul 12, 2007 08:38:47 AM
Re: Dynamic menu using JSP component
Posted: Dec 04, 2008 01:37:13 AM   in response to: metkhoo in response to: metkhoothread.responsepost
 
Click to report abuse...   Click to reply to this thread Reply
Hi,

Finally I got a way to send parameter dynamically to menu.
The code is as follows:

<%RenderingContext context = (RenderingContext)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY); %>
<wcm:initworkspace user="<%= request.getUserPrincipal() %>"/>
<% 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); %>

//Rendering the menu
<wcm:libraryComponent name="menu" library=currrentLibrary />

Regards,
Kishore
kenny_yen

Posts: 10
Registered: Oct 11, 2009 11:22:04 PM
Re: Dynamic menu using JSP component
Posted: Oct 14, 2009 08:22:16 PM   in response to: kriss_sanju in response to: kriss_sanjuthread.responsepost
 
Click to report abuse...   Click to reply to this thread Reply
Hi there, just wondering if you got any idea how to pass parameter from menu component to JSP component?
kriss_sanju

Posts: 103
Registered: Jul 12, 2007 08:38:47 AM
Re: Dynamic menu using JSP component
Posted: Oct 15, 2009 08:46:31 AM   in response to: kenny_yen in response to: kenny_yenthread.responsepost
 
Click to report abuse...   Click to reply to this thread Reply
Can you elobarate what is your requirement exactly?
nitsvault

Posts: 11
Registered: Dec 01, 2008 12:40:03 PM
Re: Dynamic menu using JSP component
Posted: Nov 11, 2009 05:37:58 PM   in response to: kriss_sanju in response to: kriss_sanjuthread.responsepost
 
Click to report abuse...   Click to reply to this thread Reply
Hi Kishore,
i have the similar requirement, pass parameter to menu component and render the menu component.
i have following code and two libraries 1. content library and 2nd is Design library.
but when i execute the following code it always gives me content library but my component is inside the design librabry
and in workspace i am setting the design library only.
if you know anything i will really appreciate that.

Thanks
-Nits

workspace.setCurrentDocumentLibrary(workspace.getDocumentLibrary(libName ));
rcjsp = (RenderingContext)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);
docSortByIds = workspace.findByName(DocumentTypes.LibraryComponent,libComponent);

String currentPath = rcjsp.getPath();
out.println("currentPath is :--->>> "+currentPath);
String lrp=rcjsp.getLibraryRelativePath();
String sublrp=lrp.substring(0,lrp.lastIndexOf("/"));
String currentLibrary =rcjsp.getLibrary().getName();
out.println("currentLibrary :-> "+currentLibrary);

Map myparams=rcjsp.getRequestParameters();
String strIndustry = "/Vault+WCM+Design+Library/industries_taxonomy/industries/law";
myparams.put("industryId", strIndustry);
rcjsp.setRequestParameters(myparams);

Point your RSS reader here for a feed of the latest messages in all forums