Message Boards
Liferay 7.3 - Spring MVC Portlet adds js/css resources twice
Sergey Shishov, modified 3 Years ago.
Liferay 7.3 - Spring MVC Portlet adds js/css resources twice
New Member Posts: 3 Join Date: 9/9/20 Recent Posts
Hello!
Liferay 7.3.0
When I use js/css resources in standard spring-mvc-portlet (from maven archetype) with liferay-portlet.xml
The resources adds at the page twice:
But!
When I try use native example without spring - war-mvc-portlet (from maven archetype), it works correctly
Easy way - not to use <header-portlet-css> when using spring and add resources in portlet body. But...
Liferay 7.3.0
When I use js/css resources in standard spring-mvc-portlet (from maven archetype) with liferay-portlet.xml
<portlet>
...
<header-portlet-css>/css/main.css</header-portlet-css>
...
</portlet>
The resources adds at the page twice:
<link href="/o/jsp-spring-mvc-portlet/css/main.css?browserId=firefox&themeId=classic_WAR_classictheme&minifierType=css&languageId=en_US&b=7301&t=1599805556000" rel="stylesheet" type="text/css">
<link href="/o/jsp-spring-mvc-portlet/css/main.css?browserId=firefox&themeId=classic_WAR_classictheme&minifierType=css&languageId=en_US&b=7301&t=1599805556000" rel="stylesheet" type="text/css">
Similar behavior with native example on github: /liferay-blade-samples/tree/7.0/maven/apps/springmvc-portletBut!
When I try use native example without spring - war-mvc-portlet (from maven archetype), it works correctly
<link href="/o/war-mvc-portlet/css/main.css?browserId=firefox&themeId=classic_WAR_classictheme&minifierType=css&languageId=en_US&b=7301&t=1599824288000" rel="stylesheet" type="text/css">
Easy way - not to use <header-portlet-css> when using spring and add resources in portlet body. But...