我创建了一个新的 liferay osgi 模块。 我的 Controller 有以下标签:
@Component(
immediate = true,
property = {
"com.liferay.portlet.display-category=Bla Modules",
"com.liferay.portlet.instanceable=true",
"javax.portlet.display-name=EventCalendar",
"javax.portlet.init-param.template-path=/",
"javax.portlet.expiration-cache=0",
"com.liferay.portlet.footer-portlet-javascript=fullcalendar_year.js,/js/custom/main.js",
"com.liferay.portlet.header-portlet-css=/css/fullcalendar_year.css,/css/fullcalendar.css",
"javax.portlet.init-param.view-template=/view.jsp",
"javax.portlet.resource-bundle=content.Language",
"javax.portlet.security-role-ref=administrator,power-user,user"
},
service = Portlet.class
然而属性
com.liferay.portlet.footer-portlet-javascript
不会加载所有的 js 文件,它只会在调用一个文件时加载文件,如果调用多个文件则不加载任何文件。
这是一个错误还是我做错了什么?
最佳答案
我终于找到了解决方案。 它必须在单独的行中声明。
property = {
"com.liferay.portlet.display-category=XXXXAA Modules",
"com.liferay.portlet.instanceable=true",
"javax.portlet.display-name=XXXXAA",
"javax.portlet.init-param.template-path=/",
"javax.portlet.expiration-cache=0",
"com.liferay.portlet.footer-portlet-javascript=/js/moment.min.js",
"com.liferay.portlet.footer-portlet-javascript=/js/fullcalendar_year.js",
"com.liferay.portlet.footer-portlet-javascript=/js/calendarLanguages/pt.js",
"com.liferay.portlet.footer-portlet-javascript=/js/custom/main.js",
"com.liferay.portlet.header-portlet-css=/css/fullcalendar_year.css,/css/fullcalendar.css",
"javax.portlet.init-param.view-template=/view.jsp",
"javax.portlet.resource-bundle=content.Language",
"javax.portlet.security-role-ref=administrator,power-user,user"
}
关于javascript - Liferay 7 CE - Osgi 模块(liferay mvc portlet)不加载 javascript 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43914434/