创建Liferay Portlet配置页面 [英] Creating a Liferay portlet configuration page
问题描述
我正在尝试为Liferay Portlet创建配置页,因此可以为其设置一些参数.例如,我想选择控制器在查看时应显示的页面.配置应位于此处:
I'm trying to create a configuration page for a Liferay portlet, so I can set some parameters for it. For example I would like to choose what page should a controller display when viewing it. The configuration should be located here:
因此,我为配置创建了一个控制器,如下所示:
So I've created a controller for the config like this:
import com.liferay.portal.kernel.portlet.ConfigurationAction;
import javax.portlet.*;
public class SandboxPortletConfig 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 {
return "/sandboxPortlet/config";
}
}
用于视图部分的JSP页面:
A JSP page for the view part:
<%@ page pageEncoding="UTF-8"%>
<%@ include file="../init.jsp"%>
<form>
Select:
<select>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</form>
我已将portlet.xml设置为包括:
I've set up my portlet.xml to include:
<portlet>
<portlet-name>sandboxPortlet</portlet-name>
<display-name>Sandbox Portlet</display-name>
<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<init-param>
<name>contextConfigLocation</name>
<value>/WEB-INF/spring/sandbox-portlet-context.xml</value>
</init-param>
<init-param>
<name>config-jsp</name>
<value>/WEB-INF/html/sandboxPortlet/config.jsp</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
</supports>
<portlet-info>
<title>Sandbox Portlet</title>
<short-title>Sandbox</short-title>
<keywords>sandbox test testing</keywords>
</portlet-info>
</portlet>
和我的liferay-portlet.xml像这样:
and my liferay-portlet.xml to be like:
<portlet>
<portlet-name>sandboxPortlet</portlet-name>
<instanceable>false</instanceable>
<configuration-action-class>path.to.the.portlet.sandboxPortlet.SandboxPortletConfig</configuration-action-class>
</portlet>
但是我看不到配置"标签.要查看配置,我还需要配置其他东西吗?
推荐答案
代替return "/sandboxPortlet/config";
提供return "/html/sandboxPortlet/config.jsp";
您必须提供完整的jsp路径.
You have to provide full jsp path.
这篇关于创建Liferay Portlet配置页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!