5

我正在尝试为 Liferay portlet 创建一个配置页面,以便为它设置一些参数。例如,我想选择控制器在查看时应该显示什么页面。配置应位于此处:

在此处输入图像描述

所以我为这样的配置创建了一个控制器:

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 页面:

<%@ page pageEncoding="UTF-8"%>
<%@ include file="../init.jsp"%>

<form>
    Select:
    <select>
        <option>1</option>
        <option>2</option>
        <option>3</option>
    </select>
</form>

我已将 portlet.xml 设置为包括:

<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 就像:

<portlet>
    <portlet-name>sandboxPortlet</portlet-name>
    <instanceable>false</instanceable>
    <configuration-action-class>path.to.the.portlet.sandboxPortlet.SandboxPortletConfig</configuration-action-class>
</portlet>

但是我看不到配置选项卡。请问我还需要配置什么才能看到配置吗?

4

1 回答 1

3

而不是return "/sandboxPortlet/config";提供return "/html/sandboxPortlet/config.jsp";

您必须提供完整的 jsp 路径。

于 2013-11-12T07:02:17.440 回答