I'm develpoping a module for my Liferay DXP and I'm struggeling with calling my renderCommands.
Following error message occurs on the initial render and whenever I try to click a link to my RenderCommand:
No render mappings found for MVC render command name "/document-management/document/edit" for portlet com_company_tools_manager_documents_web_portlet_DocumentsPortlet
I have my "view.jsp" which contains the inclusion of my "init.jsp", creation of renderURL and the link:
<%@ 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>
The "MVCCommandNames.EDIT_DOCUMENT" refers to MVCCommandNames.java:
package com.company.tools.manager.documents.web.constants;
public class MVCCommandNames {
public static final String EDIT_DOCUMENT= "/document-management/document/edit"; }
I'm including the file in the "init.jsp" like so:
<%@ page
import="com.company.tools.manager.documents.web.constants.MVCCommandNames"%>
Finally, I have this "EditDocumentMVCRenderCommand.java" which should be seen as a component and be connected to the link:
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 { (...) }
The portlets name which is called by "DocumentsPortletKeys.DOCUMENTS" is defined by
package com.company.tools.manager.documents.web.constants;
public class DocumentsPortletKeys {
public static final String DOCUMENTS= "com_company_tools_manager_documents_web_portlet_DocumentsPortlet";
}
Did I forget to connect some things? How can I find out which URL the "EditDocumentMVCRenderCommand.java" listens to? Any other suggestions on how to approach this issue?
Greetings
I had the same issue and solved it by creating a new mvc module only with the minimum amount of code (include only the files you are sharing in this post), and try to focus on making the render mapping work. Also, if you can share your DocumentsPortlet.java to verify the "javax.portlet.name" property is correct.