Portlet动态修改自定义标题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
//当前Layout
Layout layout = themeDisplay.getLayout();
//当前Layout名称(也是自定义标题)
String name = layout.getName(themeDisplay.getLocale());
//父级Layout
Layout parentLayout = LayoutLocalServiceUtil.getLayout(
	layout.getGroupId(),
	false,
	layout.getParentLayoutId()
);
//父级Layout名称(同样也是父级的自定义标题)
String parentName = parentLayout.getName();
 
//设置当前Portlet自定义标题为父级名称
renderResponse.setTitle(parentName);

发表评论

电子邮件地址不会被公开。 必填项已用*标注