Liferay Symposium 2015 | Reserve your seat today.

Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
Ravi Kiran
Why to use PortletURL?
16 de abril de 2012 13:18

Ravi Kiran

Ranking: Junior Member

Mensajes: 53

Fecha de incorporación: 7 de abril de 2012

Mensajes recientes

This thread is not a question , it was a doubt raised when i was going through LLiferay Forums about using

In Somecase i see this PortletURL inside the javscript Method

function createRowURL() {
var portletURL = new Liferay.PortletURL();
portletURL.setParameter("rowNumber", "25" );
return portletURL.toString();


In Somecase i see this PortletURL inside the doView Method as shown

To get currentURL :

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

creating PortletURL from renderResponse :

a.For RenderURL:
PortletURL renderURL = renderResponse.createRenderURL();
b.For actionURL:
PortletURL actionURL = renderResponse.createActionURL();

Could anybody please tell me in which case PortletURL would be useful ??

Thanks in advance

Once again i am sorry if this wasted your time .
David H Nebinger
RE: Why to use PortletURL?
16 de abril de 2012 13:50

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 9810

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

Dude, you really need to read a book or something...

Action URLs are used to invoke an action on the portlet, i.e. as a result of clicking on a button. It allows the portlet the chance to change it's current context (i.e. save to a database, validate parameters, or whatever).

Render URLs are used to invoke the rendering of a portlet, and should never involve some sort of state change. Renders occur when the portal wants the portlet to re-render it's content (i.e. some other portlet was invoked using an action url, now all of the portlets need to re-render their content so the portal can generate the aggregated page).

The javascript example is used to create a URL that the JS can call to invoke an action in the portlet, one that is not specified by the dom elements already on the page (which would have appropriate action urls already tied to them).
Hitoshi Ozawa
RE: Why to use PortletURL?
16 de abril de 2012 14:55

Hitoshi Ozawa

Ranking: Liferay Legend

Mensajes: 7949

Fecha de incorporación: 23 de marzo de 2010

Mensajes recientes

Portlet is only a fragment of a web page and there may be several portlets in a web page. As such, URI which you enter is your web browser to display a web page is not sufficient to determine the uri of a portlet. portlet url contains information to specify which portlet to display a page and which portlet the post was from. Otherwise, the entire portlets on a page will be refreshed and posted to instead of just one.