Foros de discusión

RE: Change the portlet title from code

thumbnail
Robert Leo Smith, modificado hace 12 años.

Change the portlet title from code

Junior Member Mensajes: 63 Fecha de incorporación: 15/10/09 Mensajes recientes
I would like to be able to change the portlet title programatically. Does anyone know of a way to do this?
thumbnail
jelmer kuperus, modificado hace 12 años.

RE: Change the portlet title from code

Liferay Legend Mensajes: 1191 Fecha de incorporación: 10/03/10 Mensajes recientes
renderResponse.setTitle
thumbnail
Robert Leo Smith, modificado hace 12 años.

RE: Change the portlet title from code

Junior Member Mensajes: 63 Fecha de incorporación: 15/10/09 Mensajes recientes
How do i get renderResponse?
thumbnail
Raja Nagendra Kumar, modificado hace 12 años.

RE: Change the portlet title from code

Expert Mensajes: 484 Fecha de incorporación: 2/03/06 Mensajes recientes
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, modificado hace 12 años.

RE: Change the portlet title from code

Junior Member Mensajes: 82 Fecha de incorporación: 23/03/11 Mensajes recientes
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, modificado hace 12 años.

RE: Change the portlet title from code

Junior Member Mensajes: 63 Fecha de incorporación: 15/10/09 Mensajes recientes
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, modificado hace 12 años.

RE: Change the portlet title from code

Junior Member Mensajes: 42 Fecha de incorporación: 23/06/10 Mensajes recientes
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, modificado hace 12 años.

RE: Change the portlet title from code

Junior Member Mensajes: 63 Fecha de incorporación: 15/10/09 Mensajes recientes
Hi Terry,

I've only done some Spring MVC examples. But don't you have the request object available via the controller?
Jon Cruz, modificado hace 11 años.

RE: Change the portlet title from code

New Member Mensajes: 14 Fecha de incorporación: 17/05/12 Mensajes recientes
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...)