如何在Liferay中使用javascript创建Action/render/portlet URL?
我无法在Liferay中使用javascript创建操作/portlet url如何在Liferay中使用javascript创建Action/render/portlet URL?,javascript,url,liferay,Javascript,Url,Liferay,我无法在Liferay中使用javascript创建操作/portlet url <aui:script use="liferay-util-window,liferay-portlet-url"> var portletURL = Liferay.PortletURL.create(--Nothing shows on IDE autocomplete post this) </aui:script> var portletURL=Liferay.portlet
<aui:script use="liferay-util-window,liferay-portlet-url">
var portletURL = Liferay.PortletURL.create(--Nothing shows on IDE autocomplete post this)
</aui:script>
var portletURL=Liferay.portletURL.create(--IDE自动完成帖子上没有显示任何内容)
编辑:
我使用的是EclipseIDE,但在键入“Liferay.PortletURL.create”时,它没有提供任何自动完成选项来创建操作/渲染或URL。
我正在使用Liferay-6.2-ce-GA2插件sdk
是否没有可用于使用javascript创建URL的自动完成功能,或者是否已被liferay中的一些新JS函数所取代
是否没有可用于使用javascript创建URL的自动完成
没有自动完成功能,因为您可以通过这种方式创建任何url。IDE无法知道在您的特定情况下什么是合理的建议。您可以创建资源URL,如下所示:
AUI().use('aui-base', 'aui-io-request', 'liferay-portlet-url', function(A) {
var A = AUI();
var myResourceURL = Liferay.PortletURL.createResourceURL();
myResourceURL.setResourceId('resourceID');
myResourceURL.setParameter("action","youractionthatwilltriggercontroller");
A.io.request(myResourceURL.toString(), {
method : 'post',
dataType : 'text',
on : {
start : function() {
//Your operations
},
success : function() {
// your operations
},
failure : function() {
},
complete : function() {
},
end : function() {
},
要创建呈现URL,可以使用以下代码:
var url = Liferay.PortletURL.createRenderURL();
url.setPortletId(pid);
url.setParameter("action", "Your-action-to-trigger");
url.setPortletMode("view");
url.setWindowState("normal");
window.location = url.toString();
要创建操作URL,只需使用:
var url = Liferay.PortletURL.createActionURL();
url.setPortletId(pid);
url.setParameter("action", "your-action");
url.setPortletMode("view");
url.setWindowState("normal");
window.href = url.toString();
我希望这就是您想要的:)请解释一下“不支持/提供”是什么意思?你是做什么的?你预期会发生什么,会发生什么?您在日志中看到了哪些错误?将检查并确认!