Foros de discusión

get portlet URL

R K, modificado hace 13 años.

get portlet URL

Junior Member Mensajes: 43 Fecha de incorporación: 24/05/10 Mensajes recientes
Hi,

How can i get the portlet URL of a particular portlet.?

I tried :

PortletURL url = PortletURLUtil.getCurrent(renderRequest, mimeResponse or renderResponse)

but this throws me an error .

Is there any other way to get portlet url.

Thanks
thumbnail
Masroor Khan, modificado hace 13 años.

RE: get portlet URL

Regular Member Mensajes: 124 Fecha de incorporación: 9/09/08 Mensajes recientes
Can i know which environment you are using.
R K, modificado hace 13 años.

RE: get portlet URL

Junior Member Mensajes: 43 Fecha de incorporación: 24/05/10 Mensajes recientes
I am using plugin sdk env.

My code is like this :
view.jsp :

<%@page import="javax.portlet.RenderRequest"%>
<%@page import="javax.portlet.RenderResponse"%>
<%@page import="javax.portlet.PortletURL"%>
<%@page import="com.liferay.portlet.PortletURLUtil"%><portlet:defineObjects />
<%! RenderRequest renderRequest; %>
<%! RenderResponse renderResponse; %>
<% PortletURL url = PortletURLUtil.getCurrent(renderRequest, renderResponse);%>

This throws an error saying " portletURL Util" cannot be resolved.

Is there any particular jar file to be added.?

Need help
thumbnail
Felix Joseph Christy, modificado hace 13 años.

RE: get portlet URL

Regular Member Mensajes: 111 Fecha de incorporación: 26/08/09 Mensajes recientes
Hi,

PortletURLUtil is a portal-impl class and is not available in plugin sdk.

try using renderResponse.createRenderURL()

Cheers,
Felix
R K, modificado hace 13 años.

RE: get portlet URL

Junior Member Mensajes: 43 Fecha de incorporación: 24/05/10 Mensajes recientes
Hi

Thanks,
I got it working.
thumbnail
Akash Jaisawal, modificado hace 9 años.

RE: get portlet URL

Regular Member Mensajes: 141 Fecha de incorporación: 3/03/12 Mensajes recientes
Felix J Christy:
Hi,

PortletURLUtil is a portal-impl class and is not available in plugin sdk.

try using renderResponse.createRenderURL()

Cheers,
Felix



Hello Felix,

I am facing same problem but using maven envt.
my code is,
<%
PortletURL curPageURL = PortletURLUtil.clone(viewPageURL, renderResponse);

for (int i = 0; i < childPages.size(); i++) {
WikiPage curPage = (WikiPage)childPages.get(i);

curPageURL.setParameter("title", curPage.getTitle());
%>


its throw an error
PortletURLUtil cannot be resolved

Thanks
Akash
thumbnail
Jitendra Rajput, modificado hace 9 años.

RE: get portlet URL

Liferay Master Mensajes: 875 Fecha de incorporación: 7/01/11 Mensajes recientes
You can create portlet url using PortletURLFactoryUtil . You can refer to this blog post to know how to create portlet url by passing portlet id.
thumbnail
Akash Jaisawal, modificado hace 9 años.

RE: get portlet URL

Regular Member Mensajes: 141 Fecha de incorporación: 3/03/12 Mensajes recientes
i already did it, i dont know why whose error was coming,
i just removed my file from tomcat>webapp and rebuild the project and it worked!

sometime liferay works like magical things!
Regrds
Akash