掲示板

ResourceURL call using window.location.href

thumbnail
9年前 に Subhasis Roy によって更新されました。

ResourceURL call using window.location.href

Expert 投稿: 275 参加年月日: 12/01/20 最新の投稿
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
9年前 に Neil Griffin によって更新されました。

RE: ResourceURL call using window.location.href

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
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
9年前 に Subhasis Roy によって更新されました。

RE: ResourceURL call using window.location.href

Expert 投稿: 275 参加年月日: 12/01/20 最新の投稿
Thank you, but without Facelets also its possible right.
thumbnail
9年前 に Neil Griffin によって更新されました。

RE: ResourceURL call using window.location.href

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
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;">