accessing inherited page metadata parameters from portlet - Websphere

This is a discussion on accessing inherited page metadata parameters from portlet - Websphere ; PortletServiceHome psh = null ; try { final Context ctx = new InitialContext(); psh = (PortletServiceHome) ctx.lookup( "portletservice/" + NavigationSelectionModelProvider.class.getName()); if (psh != null ) { final NavigationSelectionModelProvider provider = (NavigationSelectionModelProvider) psh. getPortletService(NavigationSelectionModelProvider .class); final NavigationSelectionModel model = provider.getNavigationSelectionModel(request, response); ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: accessing inherited page metadata parameters from portlet

  1. accessing inherited page metadata parameters from portlet

    PortletServiceHome psh = null ;
    try {
    final Context ctx = new InitialContext();
    psh = (PortletServiceHome) ctx.lookup( "portletservice/"
    + NavigationSelectionModelProvider.class.getName());
    if (psh != null ) {
    final NavigationSelectionModelProvider provider =
    (NavigationSelectionModelProvider) psh.
    getPortletService(NavigationSelectionModelProvider .class);
    final NavigationSelectionModel model =
    provider.getNavigationSelectionModel(request, response);
    final NavigationNode selectedNode = (NavigationNode) model.getSelectedNode();
    if (selectedNode != null ) {
    final MetaData data = (MetaData) ((MetaDataProvider)selectedNode).getMetaData();
    if (data!= null )
    locale=(String)data.getValue( "locale" );
    }
    }
    } catch (Exception ex) {
    ex.printStackTrace();
    }




    This code works properly only for direct parameters, not for inherited. How I can access to inherited page metadata parameters?

  2. Re: accessing inherited page metadata parameters from portlet

    I think you would need to back up the chain and get the metadata from the parent pages.





    IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0

    IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0



    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

  3. My solution

    My solution



    psh = (PortletServiceHome) ctx.lookup("portletservice/"

    + NavigationSelectionModelProvider.class.getName());


    if (psh != null) {

    ContentMetaDataModelProvider cmdmProvider = (ContentMetaDataModelProvider) psh.getPortletService(ContentMetaDataModelProvider .class);

    ContentMetaDataModel cmdm = cmdmProvider.getContentMetaDataModel(request, response);

    final NavigationSelectionModelProvider provider = (NavigationSelectionModelProvider) psh.getPortletService(NavigationSelectionModelProv ider.class);

    final NavigationSelectionModel model = provider.getNavigationSelectionModel(request, response);

    final NavigationNode selectedNode = (NavigationNode) model.getSelectedNode();



    if (selectedNode != null) {

    MetaData md = cmdm.getMetaData(selectedNode);



    if(md!=null)

    locale=(String)md.getValue("com.transaero.country");



    if (locale==null) locale="en";

    System.out.println("com.transaero.locale:"+locale);



    }

    }

+ Reply to Thread