Foros de discusión

Why to use PortletURL?

Ravi Kiran, modificado hace 12 años.

Why to use PortletURL?

Junior Member Mensajes: 53 Fecha de incorporación: 8/04/12 Mensajes recientes
This thread is not a question , it was a doubt raised when i was going through LLiferay Forums about using
PortletURL


In Somecase i see this PortletURL inside the javscript Method


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

</script>



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 .
thumbnail
David H Nebinger, modificado hace 12 años.

RE: Why to use PortletURL?

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 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).
thumbnail
Hitoshi Ozawa, modificado hace 12 años.

RE: Why to use PortletURL?

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 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.