创建一个新的liferay module。首先我创建的是MVC Portlet:
需要添加标签:
javax.portlet.expiration-cache=0
修改@Component控制器中标签为如下配置即可:
@Component(
immediate = true,
property = {
"com.liferay.portlet.display-category=category.sample",
"javax.portlet.expiration-cache=0",
"com.liferay.portlet.instanceable=true",
"com.liferay.portlet.header-portlet-css=/css/main.css",
"com.liferay.portlet.footer-portlet-javascript=/js/jquery-3.5.1.js",
"com.liferay.portlet.footer-portlet-javascript=/js/axios.min.js",
"javax.portlet.display-name=EmailLiferay",
"javax.portlet.init-param.template-path=/",
"javax.portlet.init-param.view-template=/view.jsp",
"javax.portlet.name=" + EmailLiferayPortletKeys.EMAILLIFERAY,
"javax.portlet.resource-bundle=content.Language",
"javax.portlet.security-role-ref=power-user,user"
},
service = Portlet.class
)