5

Liferay ポートレットの構成ページを作成しようとしているので、いくつかのパラメーターを設定できます。たとえば、コントローラーを表示するときにどのページを表示するかを選択したいと思います。構成は次の場所にあります。

ここに画像の説明を入力

したがって、次のような構成用のコントローラーを作成しました。

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 に答える