How to get Portlet Id using the portlet name in Liferay?

后端 未结 2 448
南笙
南笙 2021-01-11 22:51

I have a requirement of getting resource permission using portlet name.

I will have the name of the portlet not the Id.

Resource Permission name for a portle

2条回答
  •  有刺的猬
    2021-01-11 23:18

    You can try this:

    System.out.println("ID : " + themeDisplay.getPortletDisplay().getId());
    
    System.out.println("InstanceID: " + themeDisplay.getPortletDisplay().getInstanceId());
    
    System.out.println("Portlet Name: " + themeDisplay.getPortletDisplay().getPortletName());
    

    Don't forget:

    <% ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
        themeDisplay.getUser().getScreenName(); %>
    

提交回复
热议问题