Liferay: Create a portlet configuration page. How to provide the correct jsp path?

I want to create a configuration page for the liferay portlet.

Some code from 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>

When I launch it, I have a tab in the settings (the visualization method works, I see the "RENDER CALL" message in the console), but my jsp is not displayed, without errors and warnings. I tried different ways to provide jsp paths, but without progress. What should I do?

+4
source share
1 answer

DefaultConfigurationAction, JSP init portlet.xml(configTemplate config-jsp). render.

DefaultConfigurationAction, init .

JSP classpath, .. /WEB-INF JSP.

. .

Spring MVC ( ). (@Controller @RequestMapping("edit")). Spring , (.. JSP, , , Spring).

+3

Source: https://habr.com/ru/post/1611943/


All Articles