我正在为我的Liferay开发一个模块,我正在努力调用我的renderCommands。
以下错误消息发生在初始呈现中,每当我试图单击指向我的RenderCommand的链接时:
portlet com_company_tools_manager_documents_web_portlet_DocumentsPortlet的MVC呈现命令名“/
-management//编辑”没有发现呈现映射
我有我的"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“调用的portlets名称由
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?关于如何处理这一问题,还有其他建议吗?
问候
发布于 2022-10-20 20:14:35
我也遇到了同样的问题,并通过创建一个新的mvc模块来解决这个问题,它只需要最少的代码(只包括您在这篇文章中共享的文件),并试图将重点放在使呈现映射工作。此外,如果您可以共享您的DocumentsPortlet.java来验证"javax.portlet.name“属性是否正确。
发布于 2022-10-22 01:54:35
“没有为MVC呈现命令名找到呈现映射”表示没有表示的呈现命令的文件。
要使用MVC呈现命令,您需要以下几点:
。
在您的示例中,您缺少了一个“呈现”jsp文件。在您的EditDocumentMVCRenderCommand中,应该实现如下所示:
@Override
public String render(
RenderRequest renderRequest, RenderResponse renderResponse) {
return "/edit/document.jsp";
}您应该可以使用路径中的"/edit/document.jsp“,否则它会抛出您正在经历的错误。
https://stackoverflow.com/questions/73732385
复制相似问题