Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Robert Smith
Change the portlet title from code
1. August 2011 09:18
Antwort

Robert Smith

Rang: Junior Member

Nachrichten: 40

Eintrittsdatum: 15. Oktober 2009

Neue Beiträge

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
1. August 2011 12:01
Antwort

Jelmer Kuperus

Rang: Liferay Legend

Nachrichten: 1192

Eintrittsdatum: 10. März 2010

Neue Beiträge

renderResponse.setTitle
Robert Smith
RE: Change the portlet title from code
15. August 2011 06:50
Antwort

Robert Smith

Rang: Junior Member

Nachrichten: 40

Eintrittsdatum: 15. Oktober 2009

Neue Beiträge

How do i get renderResponse?
Raja Nagendra Kumar
RE: Change the portlet title from code
15. August 2011 07:01
Antwort

Raja Nagendra Kumar

Rang: Expert

Nachrichten: 484

Eintrittsdatum: 1. März 2006

Neue Beiträge

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
17. August 2011 10:35
Antwort

Rob Chan

Rang: Junior Member

Nachrichten: 82

Eintrittsdatum: 23. März 2011

Neue Beiträge

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
8. Februar 2012 09:51
Antwort

Robert Smith

Rang: Junior Member

Nachrichten: 40

Eintrittsdatum: 15. Oktober 2009

Neue Beiträge

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
8. Februar 2012 11:27
Antwort

Terry Jeske

Rang: Junior Member

Nachrichten: 42

Eintrittsdatum: 23. Juni 2010

Neue Beiträge

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
8. Februar 2012 11:44
Antwort

Robert Smith

Rang: Junior Member

Nachrichten: 40

Eintrittsdatum: 15. Oktober 2009

Neue Beiträge

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
14. Juni 2012 16:39
Antwort

Jon Cruz

Rang: New Member

Nachrichten: 14

Eintrittsdatum: 17. Mai 2012

Neue Beiträge

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...)