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
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(); %>