掲示板
get portlet title in JSP
15年前 に Johannes Wagener によって更新されました。
get portlet title in JSP
New Member 投稿: 3 参加年月日: 07/04/29 最新の投稿
Hello
i'm trying to get the portlet title in the view jsp.
<liferay-theme:defineObjects />
<%= themeDisplay.getPortletDisplay().getTitle() %>
works so far. but when i change the portlet title and its saved in the portlet preferences as portlet-setup-title-en_US, i still get the old default title.
is there an easy way to get the correct title (= the same title that is delivered to the browser)?
thank you.
i'm trying to get the portlet title in the view jsp.
<liferay-theme:defineObjects />
<%= themeDisplay.getPortletDisplay().getTitle() %>
works so far. but when i change the portlet title and its saved in the portlet preferences as portlet-setup-title-en_US, i still get the old default title.
is there an easy way to get the correct title (= the same title that is delivered to the browser)?
thank you.
15年前 に Santh Chetan Chadalavada によって更新されました。
Re: [Liferay Forums][3. Development] get portlet title in JSP
Junior Member 投稿: 52 参加年月日: 08/05/16 最新の投稿
Hi Johannes, can you share your code to store preferences?
Johannes Wagener from liferay.com wrote:
> Hello
> i'm trying to get the portlet title in the view jsp.
> <liferay-theme:defineObjects />
> <%= themeDisplay.getPortletDisplay().getTitle() %>
> works so far. but when i change the portlet title and its saved in the
> portlet preferences as portlet-setup-title-en_US, i still get the old
> default title.
> is there an easy way to get the correct title (= the same title that
> is delivered to the browser)?
> thank you.
> --
> Liferay Message Boards
> http://www.liferay.com/web/guest/community/forums/-/message_boards/message/2154949
> mb.239390.2154949@events.liferay.com
> http://www.liferay.com
Johannes Wagener from liferay.com wrote:
> Hello
> i'm trying to get the portlet title in the view jsp.
> <liferay-theme:defineObjects />
> <%= themeDisplay.getPortletDisplay().getTitle() %>
> works so far. but when i change the portlet title and its saved in the
> portlet preferences as portlet-setup-title-en_US, i still get the old
> default title.
> is there an easy way to get the correct title (= the same title that
> is delivered to the browser)?
> thank you.
> --
> Liferay Message Boards
> http://www.liferay.com/web/guest/community/forums/-/message_boards/message/2154949
> mb.239390.2154949@events.liferay.com
> http://www.liferay.com
15年前 に Johannes Wagener によって更新されました。
RE: get portlet title in JSP
New Member 投稿: 3 参加年月日: 07/04/29 最新の投稿
sorry, maybe a misunderstanding.
i dont store the title manually.
i changed the portlet title the usual liferay way, by clicking on the portlet title and changing the text.
i dont store the title manually.
i changed the portlet title the usual liferay way, by clicking on the portlet title and changing the text.
15年前 に Santh Chetan Chadalavada によって更新されました。
Re: [Liferay Forums][3. Development] RE: get portlet title in JSP
Junior Member 投稿: 52 参加年月日: 08/05/16 最新の投稿
Oh ok. Let me point you to this post
http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1605103
even portlet.vm gets it from portletdisplay the way you did. Not sure
why the problem?
Johannes Wagener from liferay.com wrote:
> sorry, maybe a misunderstanding.
> i dont store the title manually.
> i changed the portlet title the usual liferay way, by clicking on the
> portlet title and changing the text.
> --
> Liferay Message Boards
> http://www.liferay.com/web/guest/community/forums/-/message_boards/message/2156907
> mb.239390.2156907@events.liferay.com
> http://www.liferay.com
http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1605103
even portlet.vm gets it from portletdisplay the way you did. Not sure
why the problem?
Johannes Wagener from liferay.com wrote:
> sorry, maybe a misunderstanding.
> i dont store the title manually.
> i changed the portlet title the usual liferay way, by clicking on the
> portlet title and changing the text.
> --
> Liferay Message Boards
> http://www.liferay.com/web/guest/community/forums/-/message_boards/message/2156907
> mb.239390.2156907@events.liferay.com
> http://www.liferay.com
14年前 に Mitja Masten によって更新されました。
RE: get portlet title in JSP
New Member 投稿: 6 参加年月日: 09/08/17 最新の投稿
I have the same problem!
14年前 に Mitja Masten によって更新されました。
RE: get portlet title in JSP
New Member 投稿: 6 参加年月日: 09/08/17 最新の投稿
Found the reason.
Portlet JSP page content, where you call <%= portletDisplay.getTitle() %> is executed first. And getTitle() function returns fixed portlet (not custom) title.
Then portal renders portlet content through portal/render_portlet.jsp and common/themes/portlet.jsp. And portlet.jsp reads custom title (PortletConfigurationUtil.getPortletTitle()) and changes portletDisplay title through setTitle() function.
That is the reason, why portlet.vm template return correct custom title!
I think this is some kind of a bug and should be fixed.
Eg. portalDisplay title should be changed in earlier stage.
Portlet JSP page content, where you call <%= portletDisplay.getTitle() %> is executed first. And getTitle() function returns fixed portlet (not custom) title.
Then portal renders portlet content through portal/render_portlet.jsp and common/themes/portlet.jsp. And portlet.jsp reads custom title (PortletConfigurationUtil.getPortletTitle()) and changes portletDisplay title through setTitle() function.
That is the reason, why portlet.vm template return correct custom title!
I think this is some kind of a bug and should be fixed.
Eg. portalDisplay title should be changed in earlier stage.
11年前 に juan rodriguez によって更新されました。
RE: get portlet title in JSP
New Member 投稿: 1 参加年月日: 12/03/21 最新の投稿
Hi, i had the same problem, anyone looking on how to solve this, try this in the jsp:
it gives you the custom title the portlet has, then you just use it where you like
<%
String portletId = themeDisplay.getPortletDisplay().getId();
javax.portlet.PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(themeDisplay.getLayout(), portletId);
String portletCustomTitle = themeDisplay.getPortletDisplay().getTitle();
portletCustomTitle = portletSetup.getValue("portlet-setup-title-" + themeDisplay.getLanguageId(),portletCustomTitle);
%>
it gives you the custom title the portlet has, then you just use it where you like
<%=portletCustomTitle%>