IC SunsetThe developerWorks Connections platform will be sunset on December 31, 2019. On January 1, 2020, this forum will no longer be available. More details available on our FAQ.
Topic
  • 13 replies
  • Latest Post - ‏2019-05-14T15:05:38Z by sree-bluemix
D7GM_Venkatesh_Perumal
54 Posts

Pinned topic Sending sitearea name from Navigation component to Menu component

‏2017-11-16T10:40:37Z | portal8.5 wcm8.5 websphere

Hi,

Is there any way to pass the site area information from the Navigation component to Menu component?.  I'm trying to iterate all the contents with in multiple site areas using Navigation and Menu component.  Let me know whether it is possible?

The below sitearea-param doesn't throw any error on WCM but, it doesn't give any results.

 

on my Navigation Component:

[Component name="test-design/about-us/organisation/menu-test-organisation" resultsPerPage="10" startPage="1" sitearea-param="test-content/home/about-us/organisation/test-organisations/test-organisations"]

 

on my Menu component:

Have included the query string parameter as "sitearea-param"

  • jim.barnes
    jim.barnes
    1074 Posts
    ACCEPTED ANSWER

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2017-11-21T13:11:04Z  

    Hi Jim,

    I have configured the Menu component in the Navigation Component which is configured in the Presentation Template. 

    Thanks

    the other suggestion I would make is to try a render plugin yourself and set it, but also seeing a full screenshot of your menu and nav component would be helpful

  • jim.barnes
    jim.barnes
    1074 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2017-11-16T14:00:33Z  

    So one way we talked it was by using a jsp component  to iterate over the site areas, that then calls the navigation component with each site area

  • D7GM_Venkatesh_Perumal
    54 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2017-11-17T04:58:47Z  

    So one way we talked it was by using a jsp component  to iterate over the site areas, that then calls the navigation component with each site area

    Thanks Jim for the quick response.  Yes, we have done this from JSP earlier and it works fine too.  We just wanted to find out is there Out of the box option to handle this?  Any way to pass the values from Navigation component to Menu component.?

  • jim.barnes
    jim.barnes
    1074 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2017-11-17T13:40:09Z  

    Thanks Jim for the quick response.  Yes, we have done this from JSP earlier and it works fine too.  We just wanted to find out is there Out of the box option to handle this?  Any way to pass the values from Navigation component to Menu component.?

    you can use this to pass values

    https://www.ibm.com/support/knowledgecenter/en/SSHRKX_8.5.0/help/panel_help/plrf_rendr_plugin_request_parm.html

  • D7GM_Venkatesh_Perumal
    54 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2017-11-20T03:10:13Z  

    Hi Jim,

     

    Thanks for the inputs.  I tried to pass the value from the NAV component to MENU component using Request Pram, attribute and renderparam.  Still the values are not passed from NAV component to MENU component.

     

    In the Navigation Component (Result Design section):

    [Plugin:RequestAttribute key="siteAreaNameAttr" value="[Property field='title' type='sitearea' context='autofill']" mode="set" escape="none"]

    [Plugin:RequestParameter key="siteAreaNameParam" value="[Property field='title' type='sitearea' context='autofill']"]

    [Plugin:RenderParam key="siteAreaNameRenderParam" type="public" defaultValue="[Property field='title' type='sitearea' context='autofill']"]

     

    In the Menu Component (Result Design section):

    siteArea Param Value on MENU:: [Plugin:RequestParameter key="siteAreaNameParam"]
    siteArea Attr Value on MENU:: [Plugin:RequestAttribute key="siteAreaNameAttr" mode="get" escape="none"]
    siteArea Render Param Value:: [Plugin:RenderParam key="siteAreaNameRenderParam" type="public"]

     

     

  • jim.barnes
    jim.barnes
    1074 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2017-11-20T15:21:00Z  

    Hi Jim,

     

    Thanks for the inputs.  I tried to pass the value from the NAV component to MENU component using Request Pram, attribute and renderparam.  Still the values are not passed from NAV component to MENU component.

     

    In the Navigation Component (Result Design section):

    [Plugin:RequestAttribute key="siteAreaNameAttr" value="[Property field='title' type='sitearea' context='autofill']" mode="set" escape="none"]

    [Plugin:RequestParameter key="siteAreaNameParam" value="[Property field='title' type='sitearea' context='autofill']"]

    [Plugin:RenderParam key="siteAreaNameRenderParam" type="public" defaultValue="[Property field='title' type='sitearea' context='autofill']"]

     

    In the Menu Component (Result Design section):

    siteArea Param Value on MENU:: [Plugin:RequestParameter key="siteAreaNameParam"]
    siteArea Attr Value on MENU:: [Plugin:RequestAttribute key="siteAreaNameAttr" mode="get" escape="none"]
    siteArea Render Param Value:: [Plugin:RenderParam key="siteAreaNameRenderParam" type="public"]

     

     

    how are you calling the menu component?

  • D7GM_Venkatesh_Perumal
    54 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2017-11-21T02:23:36Z  

    how are you calling the menu component?

    Hi Jim,

    I have configured the Menu component in the Navigation Component which is configured in the Presentation Template. 

    Thanks

  • jim.barnes
    jim.barnes
    1074 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2017-11-21T13:11:04Z  

    Hi Jim,

    I have configured the Menu component in the Navigation Component which is configured in the Presentation Template. 

    Thanks

    the other suggestion I would make is to try a render plugin yourself and set it, but also seeing a full screenshot of your menu and nav component would be helpful

  • D7GM_Venkatesh_Perumal
    54 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2017-11-24T00:17:49Z  

    the other suggestion I would make is to try a render plugin yourself and set it, but also seeing a full screenshot of your menu and nav component would be helpful

    Hi Jim,  Thanks for the reply.  I managed to do it with the Request Attribute + JSP component (used request.getAttribute to get the value).

    [Plugin:RequestAttribute key="contentName" mode="set" value="[Property field='name' type='content' context='autofill']"]

  • sree-bluemix
    sree-bluemix
    8 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2019-04-26T15:36:28Z  

    Hi Jim,  Thanks for the reply.  I managed to do it with the Request Attribute + JSP component (used request.getAttribute to get the value).

    [Plugin:RequestAttribute key="contentName" mode="set" value="[Property field='name' type='content' context='autofill']"]

    Hello Venakt

    May I know how you get request Attribute in JSP component I am getting null from JSP component when I set that in Navigator Component like below

    Navigator Component:-

    [Plugin:RequestAttribute key="contentName" mode="set" value="[Property field='name' type='content' context='autofill']"]

     

    Jsp Component:-

    String strConentName =(String) request.getAttribute("contentName");

     

     

  • D7GM_Venkatesh_Perumal
    54 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2019-05-13T03:46:37Z  

    Hello Venakt

    May I know how you get request Attribute in JSP component I am getting null from JSP component when I set that in Navigator Component like below

    Navigator Component:-

    [Plugin:RequestAttribute key="contentName" mode="set" value="[Property field='name' type='content' context='autofill']"]

     

    Jsp Component:-

    String strConentName =(String) request.getAttribute("contentName");

     

     

    Hi Sree,  We can set it on the Presentation Template.  

  • sree-bluemix
    sree-bluemix
    8 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2019-05-13T17:46:34Z  

    Hi Sree,  We can set it on the Presentation Template.  

    Hello Venakt,

     

    I did not get you, can you please provide in-details how we can pass Dynamic Site Area to JSP component through Presentation Template?

     

    Thanks

  • D7GM_Venkatesh_Perumal
    54 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2019-05-14T07:49:10Z  

    Hello Venakt,

     

    I did not get you, can you please provide in-details how we can pass Dynamic Site Area to JSP component through Presentation Template?

     

    Thanks

    Neither we can pass the request attribute values from Navigator/Menu component to the JSP component nor we can pass the dynamic  sitearea values from the Presentation Template.  I did the below implementation as a workaround.

    1. Used a JSP component to access the Navigator component using WCM API.
    2. Stored all the siteareaname in a collection object and made it available on the JSP to iterate using request.setAttribute("objDataListAttr", objDataList);
    3. Iterated the collection object to get the individual site area names and generate the required dynamic content

    JSP component Code Sample:

    <%

        String libComponentName="NAV-<< navigator component name>>";
        String libCompFinalStr="";
        Map<Character, Set<String>> map = new TreeMap<Character, Set<String>>();
        Workspace myworkspace = WCM_API.getRepository().getSystemWorkspace();    
        myworkspace.login();
        myworkspace.setCurrentDocumentLibrary(myworkspace.getDocumentLibrary("<< design library name>>"));
        DocumentIdIterator docIdIterator = myworkspace.findByName(DocumentTypes.LibraryComponent,libComponentName);
            
        RenderingContext context = (RenderingContext)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);
        
        while(docIdIterator.hasNext()){    
            DocumentId did = (DocumentId)docIdIterator.next();
            LibraryComponent libComp = (LibraryComponent)myworkspace.getById(did);
            libCompFinalStr = myworkspace.render(context, libComp);
        }

     

    List<Data> objDataList = // Get the list data object from libCompFinalStr

    request.setAttribute("objDataListAttr ", objDataList );

    %>

    <c:forEach var="data" items="${objDataListAttr }">

                 ${data.siteAreaName}

     <!-- Insert your JSP component code here -->

    </c:forEach>

     

    Hope it helps.

    Updated on 2019-05-14T09:49:24Z at 2019-05-14T09:49:24Z by D7GM_Venkatesh_Perumal
  • sree-bluemix
    sree-bluemix
    8 Posts

    Re: Sending sitearea name from Navigation component to Menu component

    ‏2019-05-14T15:05:38Z  

    Neither we can pass the request attribute values from Navigator/Menu component to the JSP component nor we can pass the dynamic  sitearea values from the Presentation Template.  I did the below implementation as a workaround.

    1. Used a JSP component to access the Navigator component using WCM API.
    2. Stored all the siteareaname in a collection object and made it available on the JSP to iterate using request.setAttribute("objDataListAttr", objDataList);
    3. Iterated the collection object to get the individual site area names and generate the required dynamic content

    JSP component Code Sample:

    <%

        String libComponentName="NAV-<< navigator component name>>";
        String libCompFinalStr="";
        Map<Character, Set<String>> map = new TreeMap<Character, Set<String>>();
        Workspace myworkspace = WCM_API.getRepository().getSystemWorkspace();    
        myworkspace.login();
        myworkspace.setCurrentDocumentLibrary(myworkspace.getDocumentLibrary("<< design library name>>"));
        DocumentIdIterator docIdIterator = myworkspace.findByName(DocumentTypes.LibraryComponent,libComponentName);
            
        RenderingContext context = (RenderingContext)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);
        
        while(docIdIterator.hasNext()){    
            DocumentId did = (DocumentId)docIdIterator.next();
            LibraryComponent libComp = (LibraryComponent)myworkspace.getById(did);
            libCompFinalStr = myworkspace.render(context, libComp);
        }

     

    List<Data> objDataList = // Get the list data object from libCompFinalStr

    request.setAttribute("objDataListAttr ", objDataList );

    %>

    <c:forEach var="data" items="${objDataListAttr }">

                 ${data.siteAreaName}

     <!-- Insert your JSP component code here -->

    </c:forEach>

     

    Hope it helps.

    Thanks Venkat

    May I know what about your  Navigator component, I mean do you assign any sitearea manually ?

    which component (JSP component) do setting on rendering portlet ?