Foren

ResourceURL call using window.location.href

thumbnail
Subhasis Roy, geändert vor 9 Jahren.

ResourceURL call using window.location.href

Expert Beiträge: 275 Beitrittsdatum: 20.01.12 Neueste Beiträge
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, geändert vor 9 Jahren.

RE: ResourceURL call using window.location.href

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
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, geändert vor 9 Jahren.

RE: ResourceURL call using window.location.href

Expert Beiträge: 275 Beitrittsdatum: 20.01.12 Neueste Beiträge
Thank you, but without Facelets also its possible right.
thumbnail
Neil Griffin, geändert vor 9 Jahren.

RE: ResourceURL call using window.location.href

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
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;">