我想为liferay portlet创建一个配置页面。Liferay:创建一个portlet配置页面。如何提供正确的jsp路径?
从portlet.xml中某些代码
<portlet-name>example-config</portlet-name>
<display-name>example-to-delete</display-name>
<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<init-param>
<name>contextConfigLocation</name>
<value>/WEB-INF/spring-context/portlet/example-config-portlet.xml</value>
</init-param>
<init-param>
<name>config-jsp</name>
<value>/WEB-INF/html/jsp/config.jsp</value>
</init-param>
ConfigurationActionImpl
public class ConfigurationActionImpl implements ConfigurationAction {
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse actionResponse) throws Exception {
}
@Override
public String render(PortletConfig portletConfig, RenderRequest renderRequest,
RenderResponse renderResponse) throws Exception {
System.out.println("RENDER CALL");
return "/html/jsp/config.jsp";
}
}
的liferay-portlet.xml中
<portlet>
<portlet-name>example-to-delete</portlet-name>
<icon>/icon.png</icon>
<configuration-action-class>by.example.ConfigurationActionImpl</configuration-action-class>
<instanceable>false</instanceable>
</portlet>
当我运行它,我在配置选项的选项卡(渲染方法的作品,我在控制台中看到消息“RENDER CALL”),但我的jsp没有显示,没有错误和警告。我尝试了不同的方式来提供jsp路径,但没有进展。我该怎么办?
Init param'config-jsp'和overriden方法'ConfigurationActionImpl#render'是互斥的。当定义了“config-jsp”init参数时,您不必实现该方法。 JSP路径是否正确?再次检查日志,我相信会有一些错误 - JSP编译问题或类似的东西。 –
日志中没有错误。我尝试了不同的方式来提供jsp路径(使用config-jsp和render方法)。当我在jsp路径前删除“/”时抛出异常。在其他情况下,日志中没有错误,并且不同的路径不起作用@TomášPiňos – jahra
尝试在JSP中插入一些调试信息('<%System.out.println(“This is JSP”);%>')并评论一切(包括进口)。如果您在控制台中看到信息,我们可以排除不正确的路径。 –