Fórum

RE: Change the portlet title from code

thumbnail
Robert Leo Smith, modificado 12 Anos atrás.

Change the portlet title from code

Junior Member Postagens: 63 Data de Entrada: 15/10/09 Postagens Recentes
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 12 Anos atrás.

RE: Change the portlet title from code

Liferay Legend Postagens: 1191 Data de Entrada: 10/03/10 Postagens Recentes
renderResponse.setTitle
thumbnail
Robert Leo Smith, modificado 12 Anos atrás.

RE: Change the portlet title from code

Junior Member Postagens: 63 Data de Entrada: 15/10/09 Postagens Recentes
How do i get renderResponse?
thumbnail
Raja Nagendra Kumar, modificado 12 Anos atrás.

RE: Change the portlet title from code

Expert Postagens: 484 Data de Entrada: 02/03/06 Postagens Recentes
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 12 Anos atrás.

RE: Change the portlet title from code

Junior Member Postagens: 82 Data de Entrada: 23/03/11 Postagens Recentes
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 12 Anos atrás.

RE: Change the portlet title from code

Junior Member Postagens: 63 Data de Entrada: 15/10/09 Postagens Recentes
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 12 Anos atrás.

RE: Change the portlet title from code

Junior Member Postagens: 42 Data de Entrada: 23/06/10 Postagens Recentes
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 12 Anos atrás.

RE: Change the portlet title from code

Junior Member Postagens: 63 Data de Entrada: 15/10/09 Postagens Recentes
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 11 Anos atrás.

RE: Change the portlet title from code

New Member Postagens: 14 Data de Entrada: 17/05/12 Postagens Recentes
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...)