Foren

RE: Change the portlet title from code

thumbnail
Robert Leo Smith, geändert vor 12 Jahren.

Change the portlet title from code

Junior Member Beiträge: 63 Beitrittsdatum: 15.10.09 Neueste Beiträge
I would like to be able to change the portlet title programatically. Does anyone know of a way to do this?
thumbnail
jelmer kuperus, geändert vor 12 Jahren.

RE: Change the portlet title from code

Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
renderResponse.setTitle
thumbnail
Robert Leo Smith, geändert vor 12 Jahren.

RE: Change the portlet title from code

Junior Member Beiträge: 63 Beitrittsdatum: 15.10.09 Neueste Beiträge
How do i get renderResponse?
thumbnail
Raja Nagendra Kumar, geändert vor 12 Jahren.

RE: Change the portlet title from code

Expert Beiträge: 484 Beitrittsdatum: 02.03.06 Neueste 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
thumbnail
Rob Chan, geändert vor 12 Jahren.

RE: Change the portlet title from code

Junior Member Beiträge: 82 Beitrittsdatum: 23.03.11 Neueste 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.
thumbnail
Robert Leo Smith, geändert vor 12 Jahren.

RE: Change the portlet title from code

Junior Member Beiträge: 63 Beitrittsdatum: 15.10.09 Neueste 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.
thumbnail
Terry Jeske, geändert vor 12 Jahren.

RE: Change the portlet title from code

Junior Member Beiträge: 42 Beitrittsdatum: 23.06.10 Neueste 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).
thumbnail
Robert Leo Smith, geändert vor 12 Jahren.

RE: Change the portlet title from code

Junior Member Beiträge: 63 Beitrittsdatum: 15.10.09 Neueste 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, geändert vor 11 Jahren.

RE: Change the portlet title from code

New Member Beiträge: 14 Beitrittsdatum: 17.05.12 Neueste 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:


	protected ModelAndView handleRenderRequestInternal(RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {

		Map<string,object> model = new HashMap<string,object>();

		try {
			
			renderResponse.setTitle("This be a test, yarrr.");
			... other code
			... other code
			... other code


		} catch (Exception e) {
			e.printStackTrace();
		}

		ModelAndView modelAndView = new ModelAndView("Home", model);

		return modelAndView;
	}
</string,object></string,object>


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