フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Robert Smith
Change the portlet title from code
2011/08/01 9:18
答え

Robert Smith

ランク: Junior Member

投稿: 40

参加年月日: 2009/10/15

最近の投稿

I would like to be able to change the portlet title programatically. Does anyone know of a way to do this?
Jelmer Kuperus
RE: Change the portlet title from code
2011/08/01 12:01
答え

Jelmer Kuperus

ランク: Liferay Legend

投稿: 1192

参加年月日: 2010/03/10

最近の投稿

renderResponse.setTitle
Robert Smith
RE: Change the portlet title from code
2011/08/15 6:50
答え

Robert Smith

ランク: Junior Member

投稿: 40

参加年月日: 2009/10/15

最近の投稿

How do i get renderResponse?
Raja Nagendra Kumar
RE: Change the portlet title from code
2011/08/15 7:01
答え

Raja Nagendra Kumar

ランク: Expert

投稿: 484

参加年月日: 2006/03/01

最近の投稿

In JSP you could directly have access to renderResponce..
by tags

<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<portlet:defineObjects/>

see the tutorial to

http://docs.jboss.org/jbportal/v2.4/reference-guide/en/html/tutorials.html

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
Rob Chan
RE: Change the portlet title from code
2011/08/17 10:35
答え

Rob Chan

ランク: Junior Member

投稿: 82

参加年月日: 2011/03/23

最近の投稿

Also if you make a MVC portlet, the doView and doEdit methods get passed the renderRequest and renderResponse variables automatically, so you only need to reference it.
Robert Smith
RE: Change the portlet title from code
2012/02/08 9:51
答え

Robert Smith

ランク: Junior Member

投稿: 40

参加年月日: 2009/10/15

最近の投稿

I guess I should have elaborated some more. We are using ICEfaces for portlet development. The request object is not easily available to get the portlet title from.
Terry Jeske
RE: Change the portlet title from code
2012/02/08 11:27
答え

Terry Jeske

ランク: Junior Member

投稿: 42

参加年月日: 2010/06/23

最近の投稿

I think I have a similar problem. I am using Spring Portlet MVC and need access to some of the private RenderResponse fields (namely the _plid value).
Robert Smith
RE: Change the portlet title from code
2012/02/08 11:44
答え

Robert Smith

ランク: Junior Member

投稿: 40

参加年月日: 2009/10/15

最近の投稿

Hi Terry,

I've only done some Spring MVC examples. But don't you have the request object available via the controller?
Jon Cruz
RE: Change the portlet title from code
2012/06/14 16:39
答え

Jon Cruz

ランク: New Member

投稿: 14

参加年月日: 2012/05/17

最近の投稿

I'm a bit late to the party, but the Spring Portlet MVC way of doing it -- for those who are using that framework -- I have used:

 1
 2    protected ModelAndView handleRenderRequestInternal(RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {
 3
 4        Map<String,Object> model = new HashMap<String,Object>();
 5
 6        try {
 7            
 8            renderResponse.setTitle("This be a test, yarrr.");
 9            ... other code
10            ... other code
11            ... other code
12
13
14        } catch (Exception e) {
15            e.printStackTrace();
16        }
17
18        ModelAndView modelAndView = new ModelAndView("Home", model);
19
20        return modelAndView;
21    }


My portlet then rendered with that title.

Jon

Update: Ah, I see that Jelmer mentioned this on the second post. Well, here's an example of it's use...)