Foros de discusión

ResourceURL call using window.location.href

thumbnail
Subhasis Roy, modificado hace 9 años.

ResourceURL call using window.location.href

Expert Mensajes: 275 Fecha de incorporación: 20/01/12 Mensajes recientes
Hi,

Is it possible to make a call for ResourceURL using "window.location.href" . I also need to pass some parameters as URL param
Need some pointers on this,
thumbnail
Neil Griffin, modificado hace 9 años.

RE: ResourceURL call using window.location.href

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Yes, this is possible. Since you posted the question in the Liferay Faces forum, I assume you are using Facelets. With Liferay Faces Bridge, you can do something like this:

<portlet:resourceurl var="myResourceURL">
    <portlet:param foo="1234" />
    <portlet:param bar="asdf" />
</portlet:resourceurl>
<h:commandbutton onclick="window.location='#{myResourceURL}'; return false;" />
thumbnail
Subhasis Roy, modificado hace 9 años.

RE: ResourceURL call using window.location.href

Expert Mensajes: 275 Fecha de incorporación: 20/01/12 Mensajes recientes
Thank you, but without Facelets also its possible right.
thumbnail
Neil Griffin, modificado hace 9 años.

RE: ResourceURL call using window.location.href

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Are you using JSF? If so then we don't have a JSP equivalent of the portlet:resourceURL Facelet component tag.

If you are not using JSF, then Liferay Portal ships with an implementation of portlet:resourceURL that you can use in a plain JSP portlet. However the syntax is a little different::

<portlet:resourceurl var="myResourceURL">
    <portlet:param foo="1234" />
    <portlet:param bar="asdf" />
</portlet:resourceurl>
<input type="button" onclick="window.location='<%= myResourceURL.toString() %>'; return false;">