将conf菜单添加到我的portlet

pro*_*ton 4 portlet liferay

我正在尝试在我的自定义portlet的conf中添加一个选项卡,除了本机导入/导出和权限.

如下图所示:http://imageshack.us/photo/my-images/716/sampledn.png/

此选项卡必须允许更改定义某个变量的conf.properties中的参数值.

我怎样才能做到这一点?

问候.

Jon*_*nny 8

是的,你可以通过首先将它作为"portlet"节点的子节点添加到portlet.xml来实现:

    <init-param>
        <name>config-jsp</name>
        <value>/html/config.jsp</value>
    </init-param>
Run Code Online (Sandbox Code Playgroud)

在您的liferay-portlet.xml中,您需要将其添加为"portlet"节点的子节点:

<configuration-action-class>com.yourportlet.action.ConfigurationActionImpl</configuration-action-class>
Run Code Online (Sandbox Code Playgroud)

然后,您需要在XML中指定的目录中创建此文件,ConfigurationActionImpl应该实现ConfigurationAction接口,因此框架将如下所示:

public class ConfigurationActionImpl implements ConfigurationAction {

@Override
public String render(PortletConfig config, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {                   
    return "/html/config.jsp";
}
Run Code Online (Sandbox Code Playgroud)

如果这有帮助,或者您有任何其他问题,请告诉我们!:)