【发布时间】:2022-10-21 04:14:35
【问题描述】:
我正在为我的 Liferay DXP 开发一个模块,我正在努力调用我的 renderCommands。
在初始渲染时以及每当我尝试单击指向我的 RenderCommand 的链接时都会出现以下错误消息:
未找到 MVC 渲染命令名称的渲染映射 Portlet 的“/document-management/document/edit” com_company_tools_manager_documents_web_portlet_DocumentsPortlet
我有我的“view.jsp”,其中包含我的“init.jsp”、renderURL 的创建和链接:
<%@ include file="./init.jsp" %> <portlet:renderURL var="editDocumentURL"> <portlet:param name="mvcRenderCommandName" value="<%=MVCCommandNames.EDIT_DOCUMENT %>" ></portlet:param> </portlet:renderURL> <a href="${ editDocumentURL }">edit documents</a>“MVCCommandNames.EDIT_DOCUMENT”指的是 MVCCommandNames.java:
package com.company.tools.manager.documents.web.constants; public class MVCCommandNames { public static final String EDIT_DOCUMENT= "/document-management/document/edit"; }我将文件包含在“init.jsp”中,如下所示:
<%@ page import="com.company.tools.manager.documents.web.constants.MVCCommandNames"%>最后,我有这个“EditDocumentMVCRenderCommand.java”,它应该被视为一个组件并连接到链接:
package com.company.tools.manager.documents.web.portlet.action; import com.company.tools.manager.documents.web.constants.DocumentsPortletKeys; import com.company.tools.manager.documents.web.constants.MVCCommandNames; import com.liferay.portal.kernel.portlet.bridges.mvc.MVCRenderCommand; import org.osgi.service.component.annotations.Component; @Component(immediate = true, property = { "javax.portlet.name=" + DocumentsPortletKeys.DOCUMENTS, "mvc.command.name=" + MVCCommandNames.EDIT_DOCUMENT}, service = MVCRenderCommand.class) public class EditDocumentMVCRenderCommand implements MVCRenderCommand { (...) }“DocumentsPortletKeys.DOCUMENTS”调用的 portlet 名称定义为
package com.company.tools.manager.documents.web.constants; public class DocumentsPortletKeys { public static final String DOCUMENTS= "com_company_tools_manager_documents_web_portlet_DocumentsPortlet"; }我忘了连接一些东西吗?如何找出“EditDocumentMVCRenderCommand.java”监听的 URL? 关于如何解决这个问题的任何其他建议?
问候
【问题讨论】: